From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C174F3839B6 for ; Wed, 13 May 2026 07:56:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778658962; cv=none; b=lQYZ7X91/47A7E44GKtZzggueRzKMwLSMKDZpyxlVXlyCzPMnTNtzY5zecNEtNdfm/tVMQLF0EXAV09qymWsqxvWiX6vhR3pseOYdL7Bm0GRuzIdYceec2ipUIfAZzUkxtTk0KB3betRTZFuZuguMZ13aGpdIPrAg+hluiAOzB0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778658962; c=relaxed/simple; bh=fuagSO9Auhn2kOaYo8zbe9iNMDsp9QGFlcvHCYDAc40=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=IW1hZGGbUdTsoF7lT2HrjwAhVQeHRbVWywK0qCStPrgculdcAfJxtU3ODC108pjhqLSJb5hYzNKunzG8cxWs5wUauMXDm3YRo645KR0MdaOuAqPXNhqQjglUewbivIVPpYHJRhqI9M81nx/+MkuU5hPPGr0Tsou+Ayv4Nt2GfvU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=F0ZBXCwo; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="F0ZBXCwo" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1778658958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6kOZGQ1xoZ8vpT8iaAghYqq5Prs+nmANrISH6fWxdtY=; b=F0ZBXCwo/F2fhhnHyY6jUCQ9/b8i3hSb5gHLDalUOuEZ8AIaloagO5byuv0a2qe8a17mv5 RbzjIn8bnpHlAFbTEKBJgNOmCoQK5eJIEmP8F7D+TE8XmiftncZMG16F+OF4YNLHDfvblV rSw4GFf/rFXaj0+HZRNnQhyXw7KzaY4= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.500.181\)) Subject: Re: [PATCH v2] mm/shrinker: simplify shrinker_memcg_alloc() using guard() X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <20260513075214.2655710-1-18810879172@163.com> Date: Wed, 13 May 2026 15:55:08 +0800 Cc: akpm@linux-foundation.org, david@fromorbit.com, qi.zheng@linux.dev, roman.gushchin@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, wangxuewen Content-Transfer-Encoding: 7bit Message-Id: References: <20260513075214.2655710-1-18810879172@163.com> To: wangxuewen <18810879172@163.com> X-Migadu-Flow: FLOW_OUT > On May 13, 2026, at 15:52, wangxuewen <18810879172@163.com> 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 > --- The right place. > mm/shrinker.c | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) The change looks good to me. Acked-by: Muchun Song Thanks.