From 46c6dc75f53539225c0ef28301972a2b80efa0df Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Wed, 19 Jan 2022 10:49:04 -0500 Subject: [PATCH] LU-13799 llite: Do not get/put DIO pages We've already told the kernel we're working with these pages using the get/put_user_pages functions, and userspace must hold references on them throughout the i/o anyway. So getting/putting these vmpages is unnecessary. This saves around 7% of the time in DIO page submission, netting about that much of a performance improvement. This patch reduces i/o time in ms/GiB by: Write: 22 ms/GiB Read: 19 ms/GiB Totals: Write: 135 ms/GiB Read: 143 ms/GiB mpirun -np 1 $IOR -w -r -t 64M -b 64G -o ./iorfile --posix.odirect With previous patches in series: write 6470 MiB/s read 6354 MiB/s Plus this patch: write 7531 MiB/s read 7179 MiB/s Lustre-change: https://review.whamcloud.com/39438 Lustre-commit: 881b4c722296ff7ac22c6fd7988363f2cdad9f1e Signed-off-by: Patrick Farrel Change-Id: Icfd5bc73ba4254898d6051f11ab6aea624948763 Reviewed-on: https://review.whamcloud.com/44686 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/llite/vvp_page.c | 43 +++++++++++++------------------------------ 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/lustre/llite/vvp_page.c b/lustre/llite/vvp_page.c index 529244f..65a8703 100644 --- a/lustre/llite/vvp_page.c +++ b/lustre/llite/vvp_page.c @@ -53,20 +53,6 @@ * Page operations. * */ - -static void vvp_page_fini_common(struct vvp_page *vpg, struct pagevec *pvec) -{ - struct page *vmpage = vpg->vpg_page; - - LASSERT(vmpage != NULL); - if (pvec) { - if (!pagevec_add(pvec, vmpage)) - pagevec_release(pvec); - } else { - put_page(vmpage); - } -} - static void vvp_page_fini(const struct lu_env *env, struct cl_page_slice *slice, struct pagevec *pvec) @@ -79,7 +65,13 @@ static void vvp_page_fini(const struct lu_env *env, * VPG_FREEING state. */ LASSERT((struct cl_page *)vmpage->private != slice->cpl_page); - vvp_page_fini_common(vpg, pvec); + LASSERT(vmpage != NULL); + if (pvec) { + if (!pagevec_add(pvec, vmpage)) + pagevec_release(pvec); + } else { + put_page(vmpage); + } } static int vvp_page_own(const struct lu_env *env, @@ -452,18 +444,8 @@ static int vvp_transient_page_is_vmlocked(const struct lu_env *env, return -EBUSY; } -static void vvp_transient_page_fini(const struct lu_env *env, - struct cl_page_slice *slice, - struct pagevec *pvec) -{ - struct vvp_page *vpg = cl2vvp_page(slice); - - vvp_page_fini_common(vpg, pvec); -} - static const struct cl_page_operations vvp_transient_page_ops = { .cpo_discard = vvp_transient_page_discard, - .cpo_fini = vvp_transient_page_fini, .cpo_is_vmlocked = vvp_transient_page_is_vmlocked, .cpo_print = vvp_page_print, }; @@ -477,18 +459,19 @@ int vvp_page_init(const struct lu_env *env, struct cl_object *obj, CLOBINVRNT(env, obj, vvp_object_invariant(obj)); vpg->vpg_page = vmpage; - get_page(vmpage); - if (page->cp_type == CPT_CACHEABLE) { + if (page->cp_type == CPT_TRANSIENT) { + cl_page_slice_add(page, &vpg->vpg_cl, obj, + &vvp_transient_page_ops); + } else { + get_page(vmpage); /* in cache, decref in vvp_page_delete */ atomic_inc(&page->cp_ref); SetPagePrivate(vmpage); vmpage->private = (unsigned long)page; cl_page_slice_add(page, &vpg->vpg_cl, obj, &vvp_page_ops); - } else { - cl_page_slice_add(page, &vpg->vpg_cl, obj, - &vvp_transient_page_ops); } + return 0; } -- 1.8.3.1