From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 2A10F30BF68 for ; Mon, 23 Feb 2026 16:37:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771864623; cv=none; b=TbqF84qdwhFFZxAzROkZ7ul+rNGWRDgEb84uFGuS+t9OOS4fuSsokvjifK9bm9RwEH9pLoZDwwx6EyKaXTsBuKvghSjqEPJperAWQzRDkU8ZG7S99V2rWZoxFKwyDDSAYsP5RhEEDbJB9elXUpaW3wtDsfXll03kV8bPgLDUofI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771864623; c=relaxed/simple; bh=4nR3ks6vdAF8p/4j30tU975pQLc2amH+V3QrAEHXWDY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pHB0kMgRMpwXUK70nvaqMMxcrbdR1HLFcihrejPpSuVc1QfiWI44+ayWZoYcZsbZIHUptWpPL+4BHp5Lka6/WtFzbn8wOobfKiaSnZX2d0wTuL23OGyc8angjQjcVcrpHl8/hz9fT1iMhdvSRdbZKg61m5wP9AU6s7jyU493SVY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b=TzuB9CCO; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b="TzuB9CCO" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-8c713a6a6f8so486465285a.0 for ; Mon, 23 Feb 2026 08:37:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1771864620; x=1772469420; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WzArJKlU+ASYCguYb43+yRgFO3yBr9sECL/9qGjk+Qc=; b=TzuB9CCO2aZNrA1+dnFaRa2TN3EqurZ3L88IMU8V0kG2nehcdm0DJn40aS7O7XU3TO lXN8BR73D4HncNJecB5lEwKqfY6s3R0FEZv/NIYP7yMpeyZFGVUrezAYzmpcMGjNG43p 9JcVhMBw60ufTTaQd6CvIL/XCCUHOPfwO1U3qZbS9YZLdhijPYJjPAy5FxMjo+N6jlGv IZkkRHo5ROKKGX+egkNjPS7zVAPCoSv2L1I+C+R+KnNTvHgVe077+ouGPYtxqV4BmZTu Z06xUrAfYyv4B0kUezaAiNUcq/geKK+iz7+u7O96dKpaD1g9rXQR7M1MMONlfM6O17Gd 2SzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771864620; x=1772469420; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WzArJKlU+ASYCguYb43+yRgFO3yBr9sECL/9qGjk+Qc=; b=haKjkChfPMfKtDbGRX94CTqvAAK5AwJ38Mf78KQ+PAaNP4e6CvyAK/6fbSHCkbkrm1 R4r+h8qJw+J+a2thkGyBa04VqXEGUnNPy9LDB/xBFalhvQObJHuR6LpiS78T9V5tlCDj dLFTHsXPAWiJgaTovYlMOORPr3KaFi2h0vHTt7rwM0D7KBI0jDbTPoa9auhfJbptBaZr Gz9AsB8Xqm4pIQx0h1/T03XAc+7a4cmODDwpPl4nFUimCE3qWlEPIOZLzMDdy82S7ovO uR4C2V+kiGwsrgAVx1B0kgi/sbLAB5JYGue+h/Z0TXv5PgN/5azdgZxHi1p3Xmm/kPwD po7g== X-Forwarded-Encrypted: i=1; AJvYcCURnEDkZhwv33HJdRZPpmtFp70o1dKFiso7+OBNcJu/bfhpTi7yJLwJ2z0JVH0Sl/w29c2EvehLZIBMYJ8=@vger.kernel.org X-Gm-Message-State: AOJu0YwFRzAOKwQRqPRMNNv5wV5qT7+E8UEM6NhF313yKukpseWIOTVG snwB9lvFTsR2pkJWFENKQz1Wrb4Z7i9hl8v+k+K+NnPfbMuzgdHGIoA5B+5dmNC3AH8= X-Gm-Gg: AZuq6aJ14IElUqAalZQVd7WAZ0txeGUqskDf9PyS+4HZIydHWnZ8Z6bCa2CChl6WxSE cIEe0NdoXHWNRXPQ+VPqd9kq9vZn4b+Un/E8KMOf3ZoBp1yrssZryflTJSw6tQeHtsE0qzlsPG6 4KFEazEaTB0WSC6FUnVeJ4/hOSwm5GkfBCE2rGToqN9oeROPhZKClAkpU4tIwoG6noVpNX9JynH MDA9zORFZVs9Os6GZHMHqRQrSFww2Ix/xg2EAsXlX9gyG7XOqYEgk4l8qtSCgHEioLS4TVGh5EM lgf0J7UOYU7YnMhAx78Bg/laRcwIXZHX/vNNazuZ25ZfWJZmP/h4W9o2L01ihz3r+dPoG/nk4cU Ss17R0PwxC2fCDApX5An5/EnWlTIV323H7qs/L6VaLK1L6v9t6S59jqo/JkfOqxAMNEZ+Ip1Zt4 KugBOtfG9ydvxR0YTfodhrDg== X-Received: by 2002:a05:620a:472b:b0:8b2:e17a:17e3 with SMTP id af79cd13be357-8cb7be3b84fmr1746011685a.1.1771864619752; Mon, 23 Feb 2026 08:36:59 -0800 (PST) Received: from localhost ([2603:7000:c00:3a00:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8997e7747f0sm72340136d6.51.2026.02.23.08.36.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 08:36:58 -0800 (PST) Date: Mon, 23 Feb 2026 11:36:55 -0500 From: Johannes Weiner To: Kairui Song via B4 Relay Cc: linux-mm@kvack.org, Andrew Morton , David Hildenbrand , Lorenzo Stoakes , Zi Yan , Baolin Wang , Barry Song , Hugh Dickins , Chris Li , Kemeng Shi , Nhat Pham , Baoquan He , Yosry Ahmed , Youngjun Park , Chengming Zhou , Roman Gushchin , Shakeel Butt , Muchun Song , Qi Zheng , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Kairui Song Subject: Re: [PATCH RFC 08/15] mm, swap: store and check memcg info in the swap table Message-ID: References: <20260220-swap-table-p4-v1-0-104795d19815@tencent.com> <20260220-swap-table-p4-v1-8-104795d19815@tencent.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260220-swap-table-p4-v1-8-104795d19815@tencent.com> On Fri, Feb 20, 2026 at 07:42:09AM +0800, Kairui Song via B4 Relay wrote: > From: Kairui Song > > To prepare for merging the swap_cgroup_ctrl into the swap table, store > the memcg info in the swap table on swapout. > > This is done by using the existing shadow format. > > Note this also changes the refault counting at the nearest online memcg > level: > > Unlike file folios, anon folios are mostly exclusive to one mem cgroup, > and each cgroup is likely to have different characteristics. This is not correct. As much as I like the idea of storing the swap_cgroup association inside the shadow entry, the refault evaluation needs to happen at the level that drove eviction. Consider a workload that is split into cgroups purely for accounting, not for setting different limits: workload (limit domain) `- component A `- component B This means the two components must compete freely, and it must behave as if there is only one LRU. When pages get reclaimed in a round-robin fashion, both A and B get aged at the same pace. Likewise, when pages in A refault, they must challenge the *combined* workingset of both A and B, not just the local pages. Otherwise, you risk retaining stale workingset in one subgroup while the other one is thrashing. This breaks userspace expectations.