* Re: [PATCH 1/1] mm/oom_kill.c: simpilfy rcu call with guard(rcu)
2026-03-03 10:26 ` [PATCH 1/1] mm/oom_kill.c: simpilfy rcu call with guard(rcu) Maninder Singh
@ 2026-03-03 11:31 ` Michal Hocko
2026-03-03 12:57 ` Dmitry Ilvokhin
2026-03-03 13:40 ` Shakeel Butt
2 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2026-03-03 11:31 UTC (permalink / raw)
To: Maninder Singh; +Cc: rientjes, shakeel.butt, akpm, linux-mm, linux-kernel
On Tue 03-03-26 15:56:00, Maninder Singh wrote:
> guard(rcu)() simplifies code readability and there is
> no need of extra goto labels.
>
> Thus replacing rcu_read_lock/unlock with guard(rcu)().
>
> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Yes this simpliefies the code indeed
Acked-by: Michal Hocko <mhocko@suse.com>
Thanks!
> ---
> mm/oom_kill.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 5c6c95c169ee..9e3e88c06ead 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -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;
> }
>
> /*
> --
> 2.34.1
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] mm/oom_kill.c: simpilfy rcu call with guard(rcu)
2026-03-03 10:26 ` [PATCH 1/1] mm/oom_kill.c: simpilfy rcu call with guard(rcu) Maninder Singh
2026-03-03 11:31 ` Michal Hocko
@ 2026-03-03 12:57 ` Dmitry Ilvokhin
2026-03-03 13:40 ` Shakeel Butt
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Ilvokhin @ 2026-03-03 12:57 UTC (permalink / raw)
To: Maninder Singh
Cc: mhocko, rientjes, shakeel.butt, akpm, linux-mm, linux-kernel
On Tue, Mar 03, 2026 at 03:56:00PM +0530, Maninder Singh wrote:
> guard(rcu)() simplifies code readability and there is
> no need of extra goto labels.
>
> Thus replacing rcu_read_lock/unlock with guard(rcu)().
>
> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Dmitry Ilvokhin <d@ilvokhin.com>
> ---
> mm/oom_kill.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 5c6c95c169ee..9e3e88c06ead 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -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;
> }
>
> /*
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] mm/oom_kill.c: simpilfy rcu call with guard(rcu)
2026-03-03 10:26 ` [PATCH 1/1] mm/oom_kill.c: simpilfy rcu call with guard(rcu) Maninder Singh
2026-03-03 11:31 ` Michal Hocko
2026-03-03 12:57 ` Dmitry Ilvokhin
@ 2026-03-03 13:40 ` Shakeel Butt
2 siblings, 0 replies; 4+ messages in thread
From: Shakeel Butt @ 2026-03-03 13:40 UTC (permalink / raw)
To: Maninder Singh; +Cc: mhocko, rientjes, akpm, linux-mm, linux-kernel
On Tue, Mar 03, 2026 at 03:56:00PM +0530, Maninder Singh wrote:
> guard(rcu)() simplifies code readability and there is
> no need of extra goto labels.
>
> Thus replacing rcu_read_lock/unlock with guard(rcu)().
>
> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Thanks for the patch.
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
^ permalink raw reply [flat|nested] 4+ messages in thread