lkml.org 
[lkml]   [2021]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/9] fs: nfs: sysfs: Switch to kvfree_rcu() API
Date
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.

CC: Trond Myklebust <trond.myklebust@hammerspace.com>
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
\
 
 \ /
  Last update: 2021-11-24 12:03    [W:0.164 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site