From: Dmitry Ilvokhin <d@ilvokhin.com>
To: Maninder Singh <maninder1.s@samsung.com>
Cc: mhocko@suse.com, rientjes@google.com, shakeel.butt@linux.dev,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] mm/oom_kill.c: simpilfy rcu call with guard(rcu)
Date: Tue, 3 Mar 2026 12:57:42 +0000 [thread overview]
Message-ID: <aabaxkb_xpUMab0a@shell.ilvokhin.com> (raw)
In-Reply-To: <20260303102600.105255-1-maninder1.s@samsung.com>
On Tue, Mar 03, 2026 at 03:56:00PM +0530, Maninder Singh wrote:
> guard(rcu)() simplifies code readability and there is
> no need of extra goto labels.
>
> Thus replacing rcu_read_lock/unlock with guard(rcu)().
>
> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Dmitry Ilvokhin <d@ilvokhin.com>
> ---
> mm/oom_kill.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 5c6c95c169ee..9e3e88c06ead 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -135,19 +135,16 @@ struct task_struct *find_lock_task_mm(struct task_struct *p)
> {
> struct task_struct *t;
>
> - rcu_read_lock();
> + guard(rcu)();
>
> for_each_thread(p, t) {
> task_lock(t);
> if (likely(t->mm))
> - goto found;
> + return t;
> task_unlock(t);
> }
> - t = NULL;
> -found:
> - rcu_read_unlock();
>
> - return t;
> + return NULL;
> }
>
> /*
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-03-03 12:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260303102608epcas5p159cd0ad7dfd939c4a67fab3c7ecd7bfd@epcas5p1.samsung.com>
2026-03-03 10:26 ` Maninder Singh
2026-03-03 11:31 ` Michal Hocko
2026-03-03 12:57 ` Dmitry Ilvokhin [this message]
2026-03-03 13:40 ` Shakeel Butt
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=aabaxkb_xpUMab0a@shell.ilvokhin.com \
--to=d@ilvokhin.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maninder1.s@samsung.com \
--cc=mhocko@suse.com \
--cc=rientjes@google.com \
--cc=shakeel.butt@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