Re: [PATCH v2] mm/shrinker: simplify shrinker_memcg_alloc() using guard()
From: Muchun Song
Date: Wed May 13 2026 - 03:59:47 EST
> On May 13, 2026, at 15:52, wangxuewen <18810879172@xxxxxxx> wrote:
>
> Use guard(mutex) to automatically handle shrinker_mutex locking and
> unlocking in shrinker_memcg_alloc(). This removes the explicit
> mutex_unlock() call, the goto-based error path, and the redundant
> ret variable, resulting in cleaner and more concise code.
>
> v2:
> - Drop unused 'ret' variable to avoid compiler warning (Muchun Song).
Changelog should not be placed here.
>
> Signed-off-by: wangxuewen <wangxuewen@xxxxxxxxxx>
> ---
The right place.
> mm/shrinker.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
The change looks good to me.
Acked-by: Muchun Song <muchun.song@xxxxxxxxx>
Thanks.