]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
posix-timers: Replace call_rcu() by kfree_rcu() for simple kmem_cache_free() callback
authorJulia Lawall <Julia.Lawall@inria.fr>
Sun, 13 Oct 2024 20:16:58 +0000 (22:16 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 24 Oct 2024 09:22:54 +0000 (11:22 +0200)
Since SLOB was removed and since commit 6c6c47b063b5 ("mm, slab: call
kvfree_rcu_barrier() from kmem_cache_destroy()"), it is not longer
necessary to use call_rcu() when the callback only performs
kmem_cache_free(). Use kfree_rcu() directly.

The changes were made using Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Link: https://lore.kernel.org/all/20241013201704.49576-12-Julia.Lawall@inria.fr
kernel/time/posix-timers.c

index 4576aaed13b23b0150b3de0d4de67ca7e53d64b7..fc40dacabe78220593f45e9d8fd6e8c3a1b7b478 100644 (file)
@@ -413,18 +413,11 @@ static struct k_itimer * alloc_posix_timer(void)
        return tmr;
 }
 
-static void k_itimer_rcu_free(struct rcu_head *head)
-{
-       struct k_itimer *tmr = container_of(head, struct k_itimer, rcu);
-
-       kmem_cache_free(posix_timers_cache, tmr);
-}
-
 static void posix_timer_free(struct k_itimer *tmr)
 {
        put_pid(tmr->it_pid);
        sigqueue_free(tmr->sigq);
-       call_rcu(&tmr->rcu, k_itimer_rcu_free);
+       kfree_rcu(tmr, rcu);
 }
 
 static void posix_timer_unhash_and_free(struct k_itimer *tmr)