Re: [PATCH v2 5/8] kernel: convert process/thread iterators to for_each_*_rculock
From: sashiko-bot@kernel.org
Date: 2026-09-07 08:22:30
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Mixing goto-based cleanup labels with scope-based guard() declarations in the same function. -- commit e4ac0b901a628fa09984a6972d98830031479b53 Author: Ye Liu [off-list ref] kernel: convert process/thread iterators to for_each_*_rculock This commit replaces manual rcu_read_lock() and rcu_read_unlock() pairs combined with process/thread iterators across the kernel with the for_each_*_rculock() macros. These macros use scoped_guard(rcu) to handle the RCU lock duration.
quoted hunk ↗ jump to hunk
diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index 40d373d65f9b9..f797ce1192233 100644 --- a/kernel/trace/fgraph.c +++ b/kernel/trace/fgraph.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -1057,11 +1057,10 @@ static int alloc_retstack_tasklist(unsigned long **ret_stack_list) } } - rcu_read_lock(); - for_each_process_thread(g, t) { + for_each_process_thread_rculock(g, t) { if (start == end) { ret = -EAGAIN; - goto unlock; + goto free;
[Severity: Low] Does jumping to a manual cleanup label from within the scoped_guard(rcu) loop introduced by for_each_process_thread_rculock() violate the cleanup subsystem guidelines? According to include/linux/cleanup.h, goto and cleanup helpers should never be mixed in the same function to avoid confusing ownership semantics. Since alloc_retstack_tasklist() still uses a goto-based cleanup for ret_stack_list, should the allocation here be converted to use scope-based cleanup to avoid mixing these paradigms?
quoted hunk ↗ jump to hunk
} if (t->ret_stack == NULL) {@@ -1074,9 +1073,6 @@ static int alloc_retstack_tasklist(unsigned long **ret_stack_list) t->ret_stack = ret_stack_list[start++]; } } - -unlock: - rcu_read_unlock(); free: for (i = start; i < end; i++) kmem_cache_free(fgraph_stack_cachep, ret_stack_list[i]);
-- Sashiko AI review · https://sashiko.dev/#/patchset/20260907081334.1152889-1-ye.liu@linux.dev?part=5