mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
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:
committed by
Andrew Morton
parent
4a34e46eb5
commit
909632714f
@@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user