* Re: [PATCH] fs: nfs: sysfs: Switch to kvfree_rcu() API
[not found] ` <20211215111845.2514-4-urezki@gmail.com>
@ 2021-12-15 19:42 ` Uladzislau Rezki
0 siblings, 0 replies; only message in thread
From: Uladzislau Rezki @ 2021-12-15 19:42 UTC (permalink / raw)
To: Trond Myklebust, linux-nfs
Cc: LKML, RCU, Paul E . McKenney, Michal Hocko, Andrew Morton,
Daniel Axtens, Frederic Weisbecker, Neeraj Upadhyay,
Joel Fernandes, Peter Zijlstra, Thomas Gleixner,
Theodore Y . Ts'o, Sebastian Andrzej Siewior,
Oleksiy Avramchenko, Uladzislau Rezki
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
^ permalink raw reply [flat|nested] only message in thread