From: sashiko-bot@kernel.org
To: "Ye Liu" <ye.liu@linux.dev>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH 5/8] kernel: convert process/thread iterators to for_each_*_rcu
Date: Fri, 04 Sep 2026 08:40:41 +0000 [thread overview]
Message-ID: <20260904084041.A0E611F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260904083001.553587-6-ye.liu@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Mixing goto-based error cleanup with guard() scopes in the same function (`alloc_retstack_tasklist`).
--
commit f2b0046bb431ebefb3d059e22788f2810f0e6684
Author: Ye Liu <liuye@kylinos.cn>
kernel: convert process/thread iterators to for_each_*_rcu
This commit converts multiple manual rcu_read_lock() and iterator blocks
across the kernel to use the new for_each_*_rcu() macros.
> diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
> index 40d373d65f9b9..e522433ec8a5a 100644
> --- a/kernel/trace/fgraph.c
> +++ b/kernel/trace/fgraph.c
[ ... ]
> @@ -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_rcu(g, t) {
> if (start == end) {
> ret = -EAGAIN;
> - goto unlock;
> + goto free;
[Severity: Low]
Does this change violate the cleanup subsystem guidelines by mixing paradigms?
The for_each_process_thread_rcu() macro expands to include a
scoped_guard(rcu). However, alloc_retstack_tasklist() still uses a goto free
statement to manually clean up the ret_stack_list array allocations upon error.
According to the kernel guidelines in include/linux/cleanup.h, the
expectation is that a given function either converts all resources requiring
a goto cleanup to scope-based cleanup, or converts none of them. Mixing
goto-based error handling with guard() or scoped_guard() scopes in the same
function should be avoided.
> }
>
> 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/20260904083001.553587-1-ye.liu@linux.dev?part=5
next prev parent reply other threads:[~2026-09-04 8:40 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 8:29 [PATCH 0/8] mm: introduce for_each_process_rcu and for_each_thread_rcu Ye Liu
2026-09-04 8:29 ` [PATCH 1/8] " Ye Liu
2026-09-04 11:03 ` Michal Hocko
2026-09-04 16:25 ` Steven Rostedt
2026-09-04 21:17 ` Thomas Gleixner
2026-09-04 23:07 ` Steven Rostedt
2026-09-05 7:27 ` Thomas Gleixner
2026-09-08 8:38 ` Peter Zijlstra
2026-09-11 12:54 ` Steven Rostedt
2026-09-11 15:54 ` Bart Van Assche
2026-09-08 12:42 ` Steven Rostedt
2026-09-04 8:29 ` [PATCH 2/8] mm/oom_kill: convert process/thread iterators to for_each_*_rcu Ye Liu
2026-09-04 11:04 ` Michal Hocko
2026-09-05 0:32 ` SJ Park
2026-09-04 8:29 ` [PATCH 3/8] mm/ksm: convert process iterator to for_each_process_rcu Ye Liu
2026-09-04 11:04 ` Michal Hocko
2026-09-05 0:33 ` SJ Park
2026-09-04 8:29 ` [PATCH 4/8] mm/memory-failure: " Ye Liu
2026-09-04 11:05 ` Michal Hocko
2026-09-05 0:39 ` SJ Park
2026-09-07 3:05 ` Miaohe Lin
2026-09-04 8:29 ` [PATCH 5/8] kernel: convert process/thread iterators to for_each_*_rcu Ye Liu
2026-09-04 8:40 ` sashiko-bot [this message]
2026-09-04 11:06 ` Michal Hocko
2026-09-04 14:14 ` Günther Noack
2026-09-04 8:29 ` [PATCH 6/8] fs: " Ye Liu
2026-09-04 9:05 ` Oleg Nesterov
2026-09-04 9:22 ` Lorenzo Stoakes (ARM)
2026-09-04 11:06 ` Michal Hocko
2026-09-08 16:45 ` Alexey Dobriyan
2026-09-08 17:10 ` Lorenzo Stoakes (ARM)
2026-09-08 17:26 ` Alexey Dobriyan
2026-09-08 17:41 ` Lorenzo Stoakes (ARM)
2026-09-08 17:12 ` Oleg Nesterov
2026-09-04 8:29 ` [PATCH 7/8] lib: convert process iterator to for_each_process_rcu Ye Liu
2026-09-04 11:09 ` Michal Hocko
2026-09-04 8:30 ` [PATCH 8/8] security/landlock: convert thread iterator to for_each_thread_rcu Ye Liu
2026-09-04 12:21 ` Justin Suess
2026-09-04 14:17 ` Günther Noack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260904084041.A0E611F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=ye.liu@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.