Whamcloud - gitweb
LU-9906 osd: use pagevec for putting pages 31/30531/5
authorPatrick Farrell <paf@cray.com>
Mon, 5 Feb 2018 12:16:58 +0000 (06:16 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 14 Feb 2018 00:52:27 +0000 (00:52 +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
Signed-off-by: Patrick Farrell <paf@cray.com>
Change-Id: Ic15cb8e30887ec55e9348e50af307bfd7108c7e4
Reviewed-on: https://review.whamcloud.com/30531
Tested-by: Jenkins
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Alexey Lyashkov <c17817@cray.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_io.c

index e30e8eb..c6c72a5 100644 (file)
@@ -42,6 +42,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}*()
@@ -486,18 +488,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);
 }