Whamcloud - gitweb
LU-15198 llite: Use percpu_env for tiny_write_end 77/45477/7
authorPatrick Farrell <pfarrell@whamcloud.com>
Tue, 4 Apr 2023 14:17:13 +0000 (10:17 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 9 Dec 2024 06:05:56 +0000 (06:05 +0000)
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 <pfarrell@whamcloud.com>
Change-Id: Iadeabf145416d80f6cb063ccdc8bccb4b4b214a1
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/45477
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Aurelien Degremont <adegremont@nvidia.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/llite/rw26.c

index 697be18..38d377f 100644 (file)
@@ -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);