From: Uladzislau Rezki <urezki@gmail.com>
To: Trond Myklebust <trond.myklebust@hammerspace.com>,
linux-nfs@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>, RCU <rcu@vger.kernel.org>,
"Paul E . McKenney" <paulmck@kernel.org>,
Michal Hocko <mhocko@suse.com>,
Andrew Morton <akpm@linux-foundation.org>,
Daniel Axtens <dja@axtens.net>,
Frederic Weisbecker <frederic@kernel.org>,
Neeraj Upadhyay <neeraju@codeaurora.org>,
Joel Fernandes <joel@joelfernandes.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Theodore Y . Ts'o" <tytso@mit.edu>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Oleksiy Avramchenko <oleksiy.avramchenko@sonymobile.com>,
Uladzislau Rezki <uladzislau.rezki@sony.com>
Subject: Re: [PATCH] fs: nfs: sysfs: Switch to kvfree_rcu() API
Date: Wed, 15 Dec 2021 20:42:27 +0100 [thread overview]
Message-ID: <YbpFI7c8hSnbPixn@pc638.lan> (raw)
In-Reply-To: <20211215111845.2514-4-urezki@gmail.com>
On Wed, Dec 15, 2021 at 12:18:40PM +0100, Uladzislau Rezki (Sony) wrote:
> From: Uladzislau Rezki <uladzislau.rezki@sony.com>
>
> Instead of invoking a synchronize_rcu() to free a pointer
> after a grace period we can directly make use of new API
> that does the same but in more efficient way.
>
> TO: Trond Myklebust <trond.myklebust@hammerspace.com>
> TO: linux-nfs@vger.kernel.org
> Signed-off-by: Uladzislau Rezki <uladzislau.rezki@sony.com>
> ---
> fs/nfs/sysfs.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/fs/nfs/sysfs.c b/fs/nfs/sysfs.c
> index 8cb70755e3c9..ff88d5d58e1e 100644
> --- a/fs/nfs/sysfs.c
> +++ b/fs/nfs/sysfs.c
> @@ -113,10 +113,9 @@ static ssize_t nfs_netns_identifier_store(struct kobject *kobj,
> if (!p)
> return -ENOMEM;
> old = rcu_dereference_protected(xchg(&c->identifier, (char __rcu *)p), 1);
> - if (old) {
> - synchronize_rcu();
> - kfree(old);
> - }
> + if (old)
> + kvfree_rcu(old);
> +
> return count;
> }
>
> --
> 2.30.2
>
+ Trond Myklebust <trond.myklebust@hammerspace.com>
+ linux-nfs@vger.kernel.org
--
Vlad Rezki
parent reply other threads:[~2021-12-15 19:42 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20211215111845.2514-4-urezki@gmail.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YbpFI7c8hSnbPixn@pc638.lan \
--to=urezki@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=dja@axtens.net \
--cc=frederic@kernel.org \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=neeraju@codeaurora.org \
--cc=oleksiy.avramchenko@sonymobile.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rcu@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=trond.myklebust@hammerspace.com \
--cc=tytso@mit.edu \
--cc=uladzislau.rezki@sony.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox