From: sashiko-bot@kernel.org
To: "Ye Liu" <ye.liu@linux.dev>
Cc: linux-trace-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org
Subject: Re: [PATCH v4 13/15] fs: convert process/thread iterators to for_each_*_rculock
Date: Mon, 21 Sep 2026 10:39:14 +0000 [thread overview]
Message-ID: <20260921103914.C92411F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260921092101.89285-14-ye.liu@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] fs: mixing goto and scoped_guard in __set_oom_adj violates cleanup rules
--
commit da2e9c3ae4d6602d37bc777bfafc43d2f081d385
Author: Ye Liu <liuye@kylinos.cn>
fs: convert process/thread iterators to for_each_*_rculock
Replace the manual rcu_read_lock()/rcu_read_unlock() pairs combined
with for_each_process() and for_each_process_thread() loops in fs/
with the for_each_*_rculock() macros, which scope the RCU read lock
to the loop body via scoped_guard(rcu).
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index 58be389424605..2c47d838a1c76 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -1161,8 +1161,7 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
> if (mm) {
> struct task_struct *p;
>
> - rcu_read_lock();
> - for_each_process(p) {
> + for_each_process_rculock(p) {
[Severity: Low]
Does introducing for_each_process_rculock() here violate the rule against
mixing scope-based cleanup and goto error handling in the same function?
This macro expands to scoped_guard(rcu), introducing scope-based cleanup into
__set_oom_adj(). However, this function already uses manual goto-based error
handling:
fs/proc/base.c:__set_oom_adj() {
...
if (oom_adj < task->signal->oom_score_adj &&
!capable(CAP_SYS_RESOURCE)) {
err = -EACCES;
goto err_unlock;
}
...
err_unlock:
mutex_unlock(&oom_adj_mutex);
put_task_struct(task);
return err;
}
The subsystem guidelines require converting all resources in a function to
scope-based cleanup, or none at all, explicitly prohibiting mixing both in the
same function.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260921092101.89285-1-ye.liu@linux.dev?part=13
next prev parent reply other threads:[~2026-09-21 10:39 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 9:20 [PATCH v4 00/15] sched: introduce for_each_process_rculock and for_each_thread_rculock Ye Liu
2026-09-21 9:20 ` [PATCH v4 01/15] " Ye Liu
2026-09-21 9:41 ` sashiko-bot
2026-09-21 9:20 ` [PATCH v4 02/15] mm/oom_kill: convert process/thread iterators to for_each_*_rculock Ye Liu
2026-09-21 9:46 ` sashiko-bot
2026-09-21 19:58 ` Oleg Nesterov
2026-09-21 9:20 ` [PATCH v4 03/15] mm/ksm: convert process iterator to for_each_process_rculock Ye Liu
2026-09-21 9:51 ` sashiko-bot
2026-09-21 19:59 ` Oleg Nesterov
2026-09-21 9:20 ` [PATCH v4 04/15] mm/memory-failure: " Ye Liu
2026-09-21 9:55 ` sashiko-bot
2026-09-21 9:20 ` [PATCH v4 05/15] cpu/hotplug: " Ye Liu
2026-09-21 10:04 ` sashiko-bot
2026-09-21 9:20 ` [PATCH v4 06/15] freezer: convert thread iterator to for_each_thread_rculock Ye Liu
2026-09-21 10:07 ` sashiko-bot
2026-09-21 9:20 ` [PATCH v4 07/15] hung_task: convert process/thread iterators to for_each_*_rculock Ye Liu
2026-09-21 10:10 ` sashiko-bot
2026-09-21 9:20 ` [PATCH v4 08/15] locking/lockdep: " Ye Liu
2026-09-21 10:14 ` sashiko-bot
2026-09-21 9:20 ` [PATCH v4 09/15] rcu: convert process/thread iterator to for_each_process_thread_rculock Ye Liu
2026-09-21 10:18 ` sashiko-bot
2026-09-21 16:09 ` Paul E. McKenney
2026-09-21 9:20 ` [PATCH v4 10/15] sched: convert process/thread iterators to for_each_*_rculock Ye Liu
2026-09-21 10:23 ` sashiko-bot
2026-09-21 9:20 ` [PATCH v4 11/15] tracing/fgraph: convert process/thread iterator to for_each_process_thread_rculock Ye Liu
2026-09-21 10:27 ` sashiko-bot
2026-09-21 9:20 ` [PATCH v4 12/15] unwind: " Ye Liu
2026-09-21 10:32 ` sashiko-bot
2026-09-21 9:20 ` [PATCH v4 13/15] fs: convert process/thread iterators to for_each_*_rculock Ye Liu
2026-09-21 10:39 ` sashiko-bot [this message]
2026-09-21 9:33 ` [PATCH v4 14/15] lib: convert process iterator to for_each_process_rculock Ye Liu
2026-09-21 10:42 ` sashiko-bot
2026-09-21 20:12 ` Oleg Nesterov
2026-09-21 9:33 ` [PATCH v4 15/15] security/landlock: convert thread iterator to for_each_thread_rculock Ye Liu
2026-09-21 10:46 ` sashiko-bot
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=20260921103914.C92411F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-security-module@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox