From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 8CF7939184C; Thu, 11 Jun 2026 17:39:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781199562; cv=none; b=lUamB/kXRJBs9i5F+7iJi2/IcRXpHeTR79WDcOl//AhN2v6KL6z5KPlbt7PFIIZ4xaKrNeApp9pk52sOgoEix2EUNEGeNttnPIckzK6ev3PPvO52VAuq8EfBmiCxmvGpzCodRmuEFVilHhBBfu9uw+TNh2FiI6k23Q4Ew4VA2/w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781199562; c=relaxed/simple; bh=HMEVyLKst1VNoThhjaehgQMvN54Zu6Mff0BB2tESXzg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Eg5iOcXJSgt4CPE1PUYhmc6P6HhWNgnyutbibr381GHGAZe4F7QwyMNe8O9DZu9NjN6qIySAYkHBJtnGJr3SyUMrroJB1HbMSoUVzihCjbzU9taxCNT5Aa+U0FLH3BoLNZSPs2Cor9sgruwaD/NrXMaUdflyw2Vh+TUPCxLvGPs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BHbkmLxC; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BHbkmLxC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 484E51F00893; Thu, 11 Jun 2026 17:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781199558; bh=EDVNXhL2Pfk2NWjHVmUzJTm6IqAYDANPcobDFgmKGWg=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=BHbkmLxC9oZUeSXsvuN7EeETvKhppZNCiJLffMi5U8/+iNueDNzhoRtOta14y3//J si5BbetblwiOz15awvoRP9Q0yltQG9G4PJ0ow1o29o1wuxWPQQh8Xn0cMwpVmEfkGQ 1ImvBKSBZ7yIN7KNE9CGBNku0v4iZEjDtovmr7034CX8KGq+wWpKT5LyXiOreR7CWD DXhq+ZhzvjFsXdY8P08EpFWi3ZmjZSz15DX/bwmLQVlv1rbYnQQ05uCgwnSisfgWnv ZCfVo9utox81XMowyQqzQUOKl+KTB9gHzbYRj0UmHvXBI1s6FNwNUwyCXw87KcBLn8 oxsgp/LWYbXFQ== Date: Thu, 11 Jun 2026 17:39:16 +0000 From: Yosry Ahmed To: Hao Jia Cc: Nhat Pham , shakeel.butt@linux.dev, akpm@linux-foundation.org, tj@kernel.org, hannes@cmpxchg.org, mhocko@kernel.org, mkoutny@suse.com, chengming.zhou@linux.dev, muchun.song@linux.dev, roman.gushchin@linux.dev, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Hao Jia Subject: Re: [PATCH v3 1/4] mm/zswap: Make shrink_worker writeback cursor per-memcg Message-ID: References: <9898f83d-fae9-e284-6b85-c7f4089840a0@gmail.com> <90730fa7-62e7-d5f4-b638-23b22a8509f2@gmail.com> <1c25650e-bf98-2863-d505-9b94c385668b@gmail.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1c25650e-bf98-2863-d505-9b94c385668b@gmail.com> On Tue, Jun 09, 2026 at 11:18:26AM +0800, Hao Jia wrote: > > > On 2026/6/9 02:01, Nhat Pham wrote: > > On Mon, Jun 8, 2026 at 9:48 AM Yosry Ahmed wrote: > > > > > > > But OTOH, this does seem like a recipe for inefficient reclaim. We > > > > might exhaust hotter memory of a cgroup while sparing colder memory of > > > > another cgroup... But maybe if they're all cold anyway, then who > > > > cares, and eventually you'll get to the cold stuff of other child? > > > > > > Forgot to respond to this part, the unfairness is limited to the batch > > > size per-invocation, so it should be fine as long as you don't divide > > > the amount over 100 iterations for some reason. Also yes, all memory > > > in zswap is cold, the relative coldness is not that important (e.g. > > > compared to relative coldness during reclaim). > > > > Ok then yeah, I think we should shelve per-memcg cursor for the next > > version. Down the line, if we have more data that unfairness is an > > issue, we can always fix it. One step at a time :) > > Thanks a lot to Yosry, Nhat, and Shakeel for the great suggestions! > > Let me summarize what I plan to do in the next version to make sure we are > on the same page: > > - Drop the per-memcg cursor and keep the root cgroup cursor > (zswap_next_shrink) logic intact. > - Stick to using the zswap_writeback_only key, and change the proactive > writeback size to use the compressed size. > - Consolidate and reuse the logic between shrink_worker() and > shrink_memcg(). Enable batch writeback in the shrink_worker() path, while > keeping the writeback behavior in the zswap_store() path unchanged. > > Please let me know if I missed or misunderstood anything. Thanks again for > clearing things up! Sorry for the late response, yes I think this makes sense. However, I have some comment about how this interacts with swap tiering, let me reply to the other thread. > > Thanks, > Hao