* [PATCH 1/2] dcache: prefer kfree()/kfree_rcu() in dentry_free()
@ 2024-02-21 11:22 Dmitry Antipov
2024-02-21 11:22 ` [PATCH 2/2] eventpoll: prefer kfree_rcu() in __ep_remove() Dmitry Antipov
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Antipov @ 2024-02-21 11:22 UTC (permalink / raw)
To: Christian Brauner; +Cc: Alexander Viro, linux-fsdevel, Dmitry Antipov
In 'dentry_free()', prefer plain 'kfree()' and 'kfree_rcu()' over
'call_rcu()' with dummy '__d_free()' callback. This follows commit
878c391f74d6 ("fs: prefer kfree_rcu() in fasync_remove_entry()")
and should not be backported to stable as well.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
fs/dcache.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index b813528fb147..18770fe4ac10 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -290,13 +290,6 @@ static inline struct external_name *external_name(struct dentry *dentry)
return container_of(dentry->d_name.name, struct external_name, name[0]);
}
-static void __d_free(struct rcu_head *head)
-{
- struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu);
-
- kmem_cache_free(dentry_cache, dentry);
-}
-
static void __d_free_external(struct rcu_head *head)
{
struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu);
@@ -371,9 +364,9 @@ static void dentry_free(struct dentry *dentry)
}
/* if dentry was never visible to RCU, immediate free is OK */
if (dentry->d_flags & DCACHE_NORCU)
- __d_free(&dentry->d_u.d_rcu);
+ kfree(dentry);
else
- call_rcu(&dentry->d_u.d_rcu, __d_free);
+ kfree_rcu(dentry, d_u.d_rcu);
}
/*
--
2.43.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] eventpoll: prefer kfree_rcu() in __ep_remove()
2024-02-21 11:22 [PATCH 1/2] dcache: prefer kfree()/kfree_rcu() in dentry_free() Dmitry Antipov
@ 2024-02-21 11:22 ` Dmitry Antipov
2024-02-21 13:39 ` (subset) " Christian Brauner
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Antipov @ 2024-02-21 11:22 UTC (permalink / raw)
To: Christian Brauner; +Cc: Alexander Viro, linux-fsdevel, Dmitry Antipov
In '__ep_remove()', prefer 'kfree_rcu()' over 'call_rcu()' with
dummy 'epi_rcu_free()' callback. This follows commit 878c391f74d6
("fs: prefer kfree_rcu() in fasync_remove_entry()") and should not
be backported to stable as well.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
fs/eventpoll.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 786e023a48b2..39ac6fdf8bca 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -678,12 +678,6 @@ static void ep_done_scan(struct eventpoll *ep,
write_unlock_irq(&ep->lock);
}
-static void epi_rcu_free(struct rcu_head *head)
-{
- struct epitem *epi = container_of(head, struct epitem, rcu);
- kmem_cache_free(epi_cache, epi);
-}
-
static void ep_get(struct eventpoll *ep)
{
refcount_inc(&ep->refcount);
@@ -767,7 +761,7 @@ static bool __ep_remove(struct eventpoll *ep, struct epitem *epi, bool force)
* ep->mtx. The rcu read side, reverse_path_check_proc(), does not make
* use of the rbn field.
*/
- call_rcu(&epi->rcu, epi_rcu_free);
+ kfree_rcu(epi, rcu);
percpu_counter_dec(&ep->user->epoll_watches);
return ep_refcount_dec_and_test(ep);
--
2.43.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: (subset) [PATCH 2/2] eventpoll: prefer kfree_rcu() in __ep_remove()
2024-02-21 11:22 ` [PATCH 2/2] eventpoll: prefer kfree_rcu() in __ep_remove() Dmitry Antipov
@ 2024-02-21 13:39 ` Christian Brauner
0 siblings, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2024-02-21 13:39 UTC (permalink / raw)
To: Dmitry Antipov; +Cc: Christian Brauner, Alexander Viro, linux-fsdevel
On Wed, 21 Feb 2024 14:22:05 +0300, Dmitry Antipov wrote:
> In '__ep_remove()', prefer 'kfree_rcu()' over 'call_rcu()' with
> dummy 'epi_rcu_free()' callback. This follows commit 878c391f74d6
> ("fs: prefer kfree_rcu() in fasync_remove_entry()") and should not
> be backported to stable as well.
>
>
Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc
[2/2] eventpoll: prefer kfree_rcu() in __ep_remove()
https://git.kernel.org/vfs/vfs/c/486a793c866f
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-21 13:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-21 11:22 [PATCH 1/2] dcache: prefer kfree()/kfree_rcu() in dentry_free() Dmitry Antipov
2024-02-21 11:22 ` [PATCH 2/2] eventpoll: prefer kfree_rcu() in __ep_remove() Dmitry Antipov
2024-02-21 13:39 ` (subset) " Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox