From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-158.mta0.migadu.com [91.218.175.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E4E44E73AE for ; Fri, 18 Sep 2026 12:08:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.158 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789733305; cv=none; b=ZtQLJoHkLdtfHO+CkuS3KCUjVBlM0eEPolPxPblJk6PmnzrsIIot1kKGm4V3Ej1CzMQbZAptTpSeBh1jjRwdTUA8nj+oYl9Ugbln5hA6rg68iaBB7Gak1/GTMa1R+a1BNEGu+n4gTTnwcUhRcI2t05r9yCZ2RvUU4UMEOLu28SM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789733305; c=relaxed/simple; bh=e6Sc8d6TCv1Hiij+M19oHz2OIgibmXC/82dg97Yi2uY=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=nGoj3NiQtuR1SYGx47nZyGDr2FYPfH7DrKnbNKxuHX+nDl0MR0vFTczG16Le5UDGsF38I0UIagpJUkisyYjhMQT5EMDDbWo+D43uO6Nc6egcWEuKT/DfeVtbEDn4PNXuOOv7RMx6hyBIc1bK1yVAU7hfZ0VC3Yv9MmiRgi4gAjo= 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=W+p2LRty; arc=none smtp.client-ip=91.218.175.158 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="W+p2LRty" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=e6Sc8d6TCv1Hiij+M19oHz2OIgibmXC/82dg97Yi2uY=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789733301; v=1; x=1790338101; b=W+p2LRtyH0cD8luUar7ncxicH5z3+LEiL2RytsSSbPlZaL1AnSkNyXVEjUzCMVOMWrPV1IIo LNbNuMwZ/qDI5ZYoztb1ecqpYe/9mg/4YXOIrgJrkqTiPyp6Q8B7A+njv0eQ3KDHcMt2I/rzITp 03etA0c0yf68ljwq0WJZ4SlU= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta10.migadu.com with ESMTPS id ac9122ca51626832; Fri, 18 Sep 2026 12:08:21 +0000 X-Mizu-Trace-ID: ac9122ca51626832 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset=us-ascii 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.700.51.1.1\)) Subject: Re: [PATCH 1/4] memcg: keep swap charging under RCU protection From: Muchun Song In-Reply-To: <20260918-bingfangguo-memcgid-rework-v1-1-5bbf3220d88f@tencent.com> Date: Fri, 18 Sep 2026 20:07:59 +0800 Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Andrew Morton , Dave Chinner , Qi Zheng , Kairui Song , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , David Hildenbrand , Lorenzo Stoakes , Bingfang Guo , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20260918-bingfangguo-memcgid-rework-v1-0-5bbf3220d88f@tencent.com> <20260918-bingfangguo-memcgid-rework-v1-1-5bbf3220d88f@tencent.com> To: bingfangguo@tencent.com X-Mailer: Apple Mail (2.3864.700.51.1.1) > On Sep 18, 2026, at 17:18, Bingfang Guo via B4 Relay = wrote: >=20 > From: Bingfang Guo >=20 > This is a preparatory work for unbinding memcgid from memcg. No > functional change. >=20 > The swap charging path currently drops its RCU read lock after = acquiring > a private ID reference. This is safe because the ID reference pins the > memcg's CSS. >=20 > Moving private ID references to objcgs will remove that lifetime > guarantee. Keep the RCU read lock held while accessing the memcg for > counter charging, statistics and failure handling. (This matches what > __memcg1_swapout() already does.). >=20 > Save the private ID before dropping the RCU read lock, and use the = saved > value when recording the swap entry. The swap cluster locking remains > outside the RCU read-side critical section. >=20 > Signed-off-by: Bingfang Guo Acked-by: Muchun Song Thanks.