Re: [PATCH 8/8] security/landlock: convert thread iterator to for_each_thread_rcu
From: Günther Noack <hidden>
Date: 2026-09-04 14:17:50
Also in:
lkml
On Fri, Sep 04, 2026 at 04:30:00PM +0800, Ye Liu wrote:
quoted hunk ↗ jump to hunk
From: Ye Liu <liuye@kylinos.cn> Replace guard(rcu)() + for_each_thread() with for_each_thread_rcu(), so that the RCU read-side critical section is scoped to the loop body. No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> --- security/landlock/tsync.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)diff --git a/security/landlock/tsync.c b/security/landlock/tsync.c index 0b71e158c3f5..f1c08aae179b 100644 --- a/security/landlock/tsync.c +++ b/security/landlock/tsync.c@@ -335,9 +335,7 @@ static size_t count_additional_threads(const struct tsync_works *works) caller = current; - guard(rcu)(); - - for_each_thread(caller, thread) { + for_each_thread_rcu(caller, thread) { /* Skip current, since it is initiating the sync. */ if (thread == caller) continue;@@ -376,9 +374,7 @@ static bool schedule_task_work(struct tsync_works *works, caller = current; - guard(rcu)(); - - for_each_thread(caller, thread) { + for_each_thread_rcu(caller, thread) { /* Skip current, since it is initiating the sync. */ if (thread == caller) continue;-- 2.25.1
Reviewed-by: Günther Noack <redacted> Looks good, provided that the for_each_thread_rcu() macro gets accepted. Although, I find that in the Landlock case, it does not provide a very strong advantage over the explicit "guard(rcu)();", and I find it normally preferrable to use orthogonal APIs. –Günther