From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 365C018DB35 for ; Mon, 17 Aug 2026 02:51:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786935120; cv=none; b=qtHWsXbPYprjNz4g+E7tTkZzj4r871B4Zy+PXJPv6BJUss4nKcHpePUprR4LLRN3U2lh3CNcMqSnG7otYsikkcTyqQ8x7sqX302Rw31Mj51oDpnr3a164ln/A3Bnw7RlyUjK1uPnSa2gcEiFoSxAOScrRXGwHkpLpIpzBPnpdwU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786935120; c=relaxed/simple; bh=8QLbGlSgtfIWlcvP7lL2AeUzuhqS5Uxx1XSsYiYTNmw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SGDk/lvPBT/D6BGUa5EjDloeloA1rZp7fwZVLVDvFWe5P61d656yNCCZTeNAWChEjBfpbrVcKn29AUCNEv4aQJSF4qilY+Gax3eYp0+JmnvOgd11knCAZapv0X0HORTL/eo4LmtlMNijl30GWSfcrUiGD4ohGuJeIfoNIbuU1a4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 9745b16299e611f19a56ed5b684f684d-20260817 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.19,REQID:8a4b23c4-8c59-4b38-9c88-39599c3a48bf,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:7db8b62,CLOUDID:373428cd7313b842758528a80ea0ef58,BulkI D:nil,BulkQuantity:0,SF:80|81|82|83|102|136|850|865|898,TC:nil,Content:0|1 5|50,EDM:-3|-100,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL: 0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 9745b16299e611f19a56ed5b684f684d-20260817 X-User: duanchenghao@kylinos.cn Received: from localhost [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 159149812; Mon, 17 Aug 2026 10:51:48 +0800 Date: Mon, 17 Aug 2026 10:51:46 +0800 From: Chenghao Duan To: Pratyush Yadav Cc: pasha.tatashin@soleen.com, rppt@kernel.org, graf@amazon.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kexec@lists.infradead.org, jianghaoran@kylinos.cn Subject: Re: [PATCH] liveupdate: use scoped_guard for mutex in session operations Message-ID: <20260817025146.GA133735@chenghao-pc> References: <20260814095506.631274-1-duanchenghao@kylinos.cn> <2vxzzeyo23ol.fsf@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2vxzzeyo23ol.fsf@kernel.org> On Fri, Aug 14, 2026 at 04:10:34PM +0200, Pratyush Yadav wrote: > On Fri, Aug 14 2026, Chenghao Duan wrote: > > > Replace manually paired mutex_lock/unlock with scoped_guard to align > > with the coding style of the rest of the codebase and simplify locking > > paths. > > No. This is done explicitly because we don't want to mix gotos with the > automatic cleanup-style locking. I don't think we should change this. > Thank you for the clarification. I understand your concern about mixing `goto`-based error handling with automatic cleanup-style locking. I was wondering if these particular cases might still be suitable for using `scoped_guard()`. The patch only changes two manually paired mutex lock/unlock instances, and in both cases, the guard scope is limited to the operation that requires the mutex. The lock is released before the subsequent error-handling logic is executed, so the `goto` paths do not cross the scope of the guard. We could also use an explicit `scoped_guard { ... }` scope to make the lifetime of the guard more obvious and easier to review. Of course, I may be missing some broader considerations. If there are other reasons why these cases should retain the explicit lock/unlock pattern, I would be happy to follow your guidance. Regards, Chenghao > [...] > > -- > Regards, > Pratyush Yadav