Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Qi Zheng <qi.zheng@linux.dev>
To: wangxuewen <18810879172@163.com>,
	akpm@linux-foundation.org, david@fromorbit.com,
	roman.gushchin@linux.dev, muchun.song@linux.dev
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	wangxuewen <wangxuewen@kylinos.cn>
Subject: Re: [PATCH v1] mm/shrinker: simplify shrinker_memcg_alloc() using guard()
Date: Tue, 12 May 2026 17:12:15 +0800	[thread overview]
Message-ID: <ecdf28d9-b44f-494b-93db-b6f3006c30a8@linux.dev> (raw)
In-Reply-To: <20260512085546.368911-1-18810879172@163.com>



On 5/12/26 4:55 PM, wangxuewen 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.

I'm inclined to use guard() only for newly added code. If we were to
convert existing code, there would be countless places across the
kernel that need updating.




      parent reply	other threads:[~2026-05-12  9:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  8:55 [PATCH v1] mm/shrinker: simplify shrinker_memcg_alloc() using guard() wangxuewen
2026-05-12  9:10 ` Muchun Song
2026-05-12  9:12 ` Qi Zheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ecdf28d9-b44f-494b-93db-b6f3006c30a8@linux.dev \
    --to=qi.zheng@linux.dev \
    --cc=18810879172@163.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=wangxuewen@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox