From 2a2adfd04245a24148d8de29b8558cd98c92bffa Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Mon, 5 Feb 2018 06:16:58 -0600 Subject: [PATCH] LU-9906 osd: use pagevec for putting pages 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 Change-Id: Ic15cb8e30887ec55e9348e50af307bfd7108c7e4 Reviewed-on: https://review.whamcloud.com/30531 Tested-by: Jenkins Reviewed-by: Jinshan Xiong Reviewed-by: Alexey Lyashkov Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- lustre/osd-ldiskfs/osd_io.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index e30e8eb..c6c72a5 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -42,6 +42,8 @@ #include /* prerequisite for linux/xattr.h */ #include +#include +#include /* * 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); } -- 1.8.3.1