From: Patrick Farrell Date: Tue, 4 Apr 2023 14:17:13 +0000 (-0400) Subject: LU-15198 llite: Use percpu_env for tiny_write_end X-Git-Tag: 2.16.51~124 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F77%2F45477%2F7;p=fs%2Flustre-release.git 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 --- 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);