Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Maninder Singh and committed by
Andrew Morton
90963271 4a34e46e

+3 -6
+3 -6
mm/oom_kill.c
··· 135 135 { 136 136 struct task_struct *t; 137 137 138 - rcu_read_lock(); 138 + guard(rcu)(); 139 139 140 140 for_each_thread(p, t) { 141 141 task_lock(t); 142 142 if (likely(t->mm)) 143 - goto found; 143 + return t; 144 144 task_unlock(t); 145 145 } 146 - t = NULL; 147 - found: 148 - rcu_read_unlock(); 149 146 150 - return t; 147 + return NULL; 151 148 } 152 149 153 150 /*