Linux Modules
 help / color / mirror / Atom feed
* [PATCH] module: dups: don't hold mutex across synchronize_rcu()
@ 2026-06-02  4:17 Naveen Kumar Chaudhary
  2026-06-02  4:24 ` sashiko-bot
  2026-06-02  7:50 ` Petr Pavlu
  0 siblings, 2 replies; 3+ messages in thread
From: Naveen Kumar Chaudhary @ 2026-06-02  4:17 UTC (permalink / raw)
  To: mcgrof, petr.pavlu, da.gomez, samitolvanen, linux-modules

kmod_dup_request_delete() calls synchronize_rcu() while holding
kmod_dup_mutex. This is unnecessary since list_del_rcu() only needs
the mutex for list manipulation, and the RCU grace period just needs
to complete before kfree(). Holding the mutex across the grace period
blocks all other kmod_dup_mutex users for the duration, causing
unnecessary latency.

Move synchronize_rcu() after the mutex is released.

Signed-off-by: Naveen Kumar Chaudhary <naveen.osdev@gmail.com>
---
 kernel/module/dups.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/module/dups.c b/kernel/module/dups.c
index 1d720a5311ba..46e74c06ed52 100644
--- a/kernel/module/dups.c
+++ b/kernel/module/dups.c
@@ -88,8 +88,8 @@ static void kmod_dup_request_delete(struct work_struct *work)
 	 */
 	mutex_lock(&kmod_dup_mutex);
 	list_del_rcu(&kmod_req->list);
-	synchronize_rcu();
 	mutex_unlock(&kmod_dup_mutex);
+	synchronize_rcu();
 	kfree(kmod_req);
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-02  7:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02  4:17 [PATCH] module: dups: don't hold mutex across synchronize_rcu() Naveen Kumar Chaudhary
2026-06-02  4:24 ` sashiko-bot
2026-06-02  7:50 ` Petr Pavlu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox