Whamcloud - gitweb
LU-9906 osd: use pagevec for putting pages 88/33988/2
authorPatrick Farrell <paf@cray.com>
Mon, 5 Feb 2018 12:16:58 +0000 (06:16 -0600)
committerOleg Drokin <green@whamcloud.com>
Fri, 15 Feb 2019 01:28:50 +0000 (01:28 +0000)
Using a pagevec instead of individual page puts is much
more efficient.  This should reduce contention on the page
cache allocation/freeing, which becomes a bottleneck with
high speed OSTs.

Cray-bug-id: LUS-5670

Lustre-change: https://review.whamcloud.com/30531
Lustre-commit: 2a2adfd04245a24148d8de29b8558cd98c92bffa

Signed-off-by: Patrick Farrell <paf@cray.com>
Change-Id: Ic15cb8e30887ec55e9348e50af307bfd7108c7e4
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Alexey Lyashkov <c17817@cray.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/33988
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/osd-ldiskfs/osd_io.c

index 0f3aa61..8f7aa93 100644 (file)
@@ -44,6 +44,8 @@
 #include <linux/types.h>
 /* prerequisite for linux/xattr.h */
 #include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/pagevec.h>
 
 /*
  * struct OBD_{ALLOC,FREE}*()
@@ -488,18 +490,25 @@ static struct page *osd_get_page(struct dt_object *dt, loff_t offset,
 static int osd_bufs_put(const struct lu_env *env, struct dt_object *dt,
                        struct niobuf_local *lnb, int npages)
 {
+       struct pagevec pvec;
        int i;
 
+       pagevec_init(&pvec, 0);
+
        for (i = 0; i < npages; i++) {
                if (lnb[i].lnb_page == NULL)
                        continue;
                LASSERT(PageLocked(lnb[i].lnb_page));
                unlock_page(lnb[i].lnb_page);
-               put_page(lnb[i].lnb_page);
+               if (pagevec_add(&pvec, lnb[i].lnb_page) == 0)
+                       pagevec_release(&pvec);
                dt_object_put(env, dt);
                lnb[i].lnb_page = NULL;
        }
 
+       /* Release any partial pagevec */
+       pagevec_release(&pvec);
+
        RETURN(0);
 }