]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm/oom_kill.c: simpilfy rcu call with guard(rcu)
authorManinder Singh <maninder1.s@samsung.com>
Tue, 3 Mar 2026 10:26:00 +0000 (15:56 +0530)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:53:17 +0000 (13:53 -0700)
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>
mm/oom_kill.c

index 54b7a8fe5136657ad92c46f87cdfcdf8eefafef0..5f372f6e26fa329d3152fac961a7bdb82d7f06cd 100644 (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;
 }
 
 /*