mm/oom_kill.c: simpilfy rcu call with guard(rcu)

guard(rcu)() simplifies code readability and there is no need of extra
goto labels.

Thus replacing rcu_read_lock/unlock with guard(rcu)().

Link: https://lkml.kernel.org/r/20260303102600.105255-1-maninder1.s@samsung.com
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Dmitry Ilvokhin <d@ilvokhin.com>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Maninder Singh
2026-03-03 15:56:00 +05:30
committed by Andrew Morton
parent 4a34e46eb5
commit 909632714f

View File

@@ -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;
}
/*