From: Maninder Singh <maninder1.s@samsung.com>
To: mhocko@suse.com, rientjes@google.com, shakeel.butt@linux.dev,
akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Maninder Singh <maninder1.s@samsung.com>
Subject: [PATCH 1/1] mm/oom_kill.c: simpilfy rcu call with guard(rcu)
Date: Tue, 3 Mar 2026 15:56:00 +0530 [thread overview]
Message-ID: <20260303102600.105255-1-maninder1.s@samsung.com> (raw)
In-Reply-To: <CGME20260303102608epcas5p159cd0ad7dfd939c4a67fab3c7ecd7bfd@epcas5p1.samsung.com>
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>
---
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 parent reply other threads:[~2026-03-03 10:26 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 [this message]
2026-03-03 11:31 ` Michal Hocko
2026-03-03 12:57 ` Dmitry Ilvokhin
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=20260303102600.105255-1-maninder1.s@samsung.com \
--to=maninder1.s@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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