From 2a645028adc8bc4ad452e3cd836dffc9662045dc Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Tue, 4 Apr 2023 10:17:13 -0400 Subject: [PATCH] LU-15198 llite: Use percpu_env for tiny_write_end The percpu cl_env can be used in situations where it is known the caller will not be rescheduled. This is true for ll_tiny_write_end, and switching to the percpu env gives a performance improvement of a little over 7%. dd, write size 8 bytes Before: 14.3 MiB/s After: 15.4 MiB/s Signed-off-by: Patrick Farrell Change-Id: Iadeabf145416d80f6cb063ccdc8bccb4b4b214a1 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/45477 Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Reviewed-by: Aurelien Degremont Tested-by: jenkins Tested-by: Maloo --- lustre/llite/rw26.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 697be18..38d377f 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -956,33 +956,28 @@ static int ll_tiny_write_end(struct file *file, struct address_space *mapping, struct cl_page *clpage = (struct cl_page *) vmpage->private; loff_t kms = pos+copied; loff_t to = kms & (PAGE_SIZE-1) ? kms & (PAGE_SIZE-1) : PAGE_SIZE; - __u16 refcheck; - struct lu_env *env = cl_env_get(&refcheck); + struct lu_env *env; int rc = 0; ENTRY; - if (IS_ERR(env)) { - rc = PTR_ERR(env); - goto out; - } - /* This page is dirty in cache, so it should have a cl_page pointer * set in vmpage->private. */ LASSERT(clpage != NULL); if (copied == 0) - goto out_env; + goto out; + + /* env_percpu_get cannot fail */ + env = cl_env_percpu_get(); /* Update the underlying size information in the OSC/LOV objects this * page is part of. */ cl_page_touch(env, clpage, to); -out_env: - cl_env_put(env, &refcheck); - + cl_env_percpu_put(env); out: /* Must return page unlocked. */ unlock_page(vmpage); -- 1.8.3.1