]> git.ipfire.org Git - thirdparty/linux.git/commit
mm/shrinker: simplify shrinker_memcg_alloc() using guard()
authorwangxuewen <18810879172@163.com>
Wed, 13 May 2026 07:52:14 +0000 (15:52 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 2 Jun 2026 22:22:17 +0000 (15:22 -0700)
commit12ccf2bef35c4f42f7bf433f7ab699ec103e7f53
treeebf8e6e0dd3943ce59ce16482f8515d41515515a
parent0496a59745b0723ea74274db16fd5c8b1379b9a9
mm/shrinker: simplify shrinker_memcg_alloc() using guard()

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.

Link: https://lore.kernel.org/20260513075214.2655710-1-18810879172@163.com
Signed-off-by: wangxuewen <wangxuewen@kylinos.cn>
Acked-by: Muchun Song <muchun.song@linux.dev>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Xuewen Wang <wangxuewen@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shrinker.c