Commit 90963271 authored by Maninder Singh's avatar Maninder Singh Committed by Andrew Morton
Browse files

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: default avatarManinder Singh <maninder1.s@samsung.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Reviewed-by: default avatarDmitry Ilvokhin <d@ilvokhin.com>
Acked-by: default avatarShakeel Butt <shakeel.butt@linux.dev>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 4a34e46e
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -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;
}

/*