diff mbox series

[2/2] eventpoll: prefer kfree_rcu() in __ep_remove()

Message ID 20240221112205.48389-2-dmantipov@yandex.ru (mailing list archive)
State New, archived
Headers show
Series [1/2] dcache: prefer kfree()/kfree_rcu() in dentry_free() | expand

Commit Message

Dmitry Antipov Feb. 21, 2024, 11:22 a.m. UTC
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(-)

Comments

Christian Brauner Feb. 21, 2024, 1:39 p.m. UTC | #1
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
diff mbox series

Patch

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);