From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pz2-f43.google.com (mail-pz2-f43.google.com [74.125.228.43]) (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 C727D442373 for ; Fri, 25 Sep 2026 19:21:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790364105; cv=none; b=oIs+GLoKFOtjcBy9R+m2w8CXalKnnItZ4dQF145RceDnaMOXJurX8yw/e3ZiZBy4XltfW9S+5nqXSxp34xr4naiqDaT6HUQgdTvxpGoxaYCmpSxENIBGhObt922+iDTHYVPDoMsqQGpnDLCNjRPfLieYIoRg6/njyatTPLGu5js= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790364105; c=relaxed/simple; bh=AnW3FoapXOivL/XrYzT5pF2wRXd8Iw8zMnVMCQAyolo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AZo2zX9wr+45o8ma+rlhPo2JfK1jv5oLj8s7QAudXxH4EoWAM6xcy+ztUCB6ft0wLsoLLDCggfKkeny21Ik1Y1uetRTuONbWtrLtuVNbSluotm+UOYOzRIGUQFDOfS6+CgBw62cseYZXA3R5/36JUo3LkumsrvAqLQp5xOXm528= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nmcqFz/q; arc=none smtp.client-ip=74.125.228.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nmcqFz/q" Received: by mail-pz2-f43.google.com with SMTP id d2e1a72fcca58-85469b355ffso641509b3a.1 for ; Fri, 25 Sep 2026 12:21:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790364103; x=1790968903; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=0Jb6ew+moeljvdv7wET58Ij2hd/p8EP7Hag+x2wkklw=; b=nmcqFz/qyOukKj34wtiHPfe3qgKtVZfvOidqK217MgnoZleXmfwJcyIcKX6jN0szhg z5c9mUsleUxRpujUCS1P6eHIVH3DpQiN/Q7fH2XCLjxBYLqTcyhjL36K3E5EWSuaFTes gso2OgKzumbGFolOS7269W1nOMkh2oLlKbnxdXHf8YWHKVSq/BWuIgs/9NDatJKFZAxD FmlFhqyqgyvM55Pt3nucmo4DMsMQEhNg0uQXYL8STnnPlqtL8nvtt0OLfWP684jdu1LO zAz1ODZEOtDHRoasIQbhNI61Xcf6qDH+rI4sVUzsMChYj+Uw5/Q3Sx9TLVtf0IiKaLd+ //IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790364103; x=1790968903; h=in-reply-to:content-disposition:content-type: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 :content-type; bh=0Jb6ew+moeljvdv7wET58Ij2hd/p8EP7Hag+x2wkklw=; b=GKzY3F7+ivZN5VgrxiaQYnky4LgU2doer/85SGc/hqM/d2IDg4SiKw0JG3+OLjVuH/ 5hQiNlX8tgdAurQsAZGFjRTK4vkyaCwIjS5gxztJhrWwbxoSk87I1FU8bAEjP/UT5pd5 Tdkv0UN382x2uieex4520h4olu0itqxFAtAWiCuvwsRa28S+BoqxtjFc/968EnkfRxUq h4IEmlNvhSlzg/qmnf8OYrbnsyiFnTgg8PfFFahioyoHMQTGuMIlzWbLU4/G9SZtkNDR OVm8CZgykSAS67ms8GuOaD35/xuR/O4jXMNrJLJSJFJvrCyr5IgJ9pHEW0u57uSz8eRE i79g== X-Forwarded-Encrypted: i=1; AKwUvBxpfzN8pLouPPX57+j9vxzk8C6QKuoRQj5d2S+5cDrBNF5FaqDTAgk0mQVSHaKJV60Fw4y1/X2PjHw=@vger.kernel.org X-Gm-Message-State: AFuF++n6H2b4TTasMzNWS9FzFf92t3hVk7UuFYs6/T0Q6Qr9Z//P3ziE PnASMukZNKrlJTuq5pkivTp1SXJ6CWpOEEdPklxmbtW7wI86ssjaNCok X-Gm-Gg: AYBFou0kIJRYWxnByK7fSTWdmjt2ASKNFeqLzXcdzammhK1Kg0Hsl6Vw6CvGYuoJX/Y PhsFT4LqHcHx9+HML24py9jyXvQqGwoq4DgFyGscvu6EWZIvh1l3wNJofBphMylFHu9pvGoHC0g IDEvK8duehC40uSk7vEu+YwFMlAPqmbstmupopCO9JLciW4/syCU13whH5xukuuh7CeIrjXYaQk xvF4YwrBMIwzbQIWZihHUFvtpq6EJKGHxy2ykTg7HMJIIoFPm+oR6YJSjSYPoekvkWy37s8KoMv gzi/oAMb0J8gshATuNcIcw36VfDHl5zey1POQiMMy6zuE7+E31mxTL+xT4DyzxHYPk7d7vnHS15 IIslRDhLvS2u0PTaROzsNbJzxi4LfjQG7dnGDOrme90jwLrE+miQaUhz0Pg4O34eHfpytvgZyO0 2UH9NpumaluaA4EMWi0HjOv4//D1mXln7PoWvkY5vjCJnnp3RBHvkmij9n0L9W7hptINOKjgWVQ B2T9m8AgjZSCT+WEXSBsWz4LKLxLqj/YFtyGgk= X-Received: by 2002:a05:6a00:10d2:b0:87c:9094:b72f with SMTP id d2e1a72fcca58-87e98789dbdmr5541733b3a.12.1790364103038; Fri, 25 Sep 2026 12:21:43 -0700 (PDT) Received: from KASONG-MC4 ([1.203.116.237]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-87feaf83e0fsm1597652b3a.37.2026.09.25.12.21.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2026 12:21:41 -0700 (PDT) Date: Sat, 26 Sep 2026 03:21:30 +0800 From: Kairui Song To: Johannes Weiner , YoungJun Park Cc: Chris Li , Nhat Pham , Rik van Riel , Baoquan He , Shakeel Butt , Kairui Song , Michal Hocko , Roman Gushchin , Yosry Ahmed , David Hildenbrand , Muchun Song , Kemeng Shi , Barry Song , YoungJun Park , Chengming Zhou , "Lorenzo Stoakes (Oracle)" , "Liam R. Howlett" , "Vlastimil Babka (SUSE)" , Mike Rapoport , Suren =?utf-8?B?QmFnaGRhc2FyeWFu77+8?= , Qi Zheng , Axel Rasmussen , Yuanchu Xie , Wei Xu , Gregory Price , Wenchao Hao , Jonathan Corbet , Hugh Dickins , Baolin Wang , Tejun Heo , Michal =?utf-8?Q?Koutn=C3=BD?= , Shuah Khan , Kunwu Chan , Meta kernel team , Linux Memory Management List , Linux Kernel Mailing List , linux-doc@vger.kernel.org, "open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)" , Andrew Morton , Joshua Hahn Subject: Re: Path forward for Virtualized Swap? Message-ID: References: <7ee199ddee81bf8026688def82f78ad9db09be9e.camel@surriel.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=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Sep 25, 2026 at 11:41:31AM +0800, Johannes Weiner wrote: > > Thanks for your thoughtful email, Kairui. Hello Johannes, > > I also want to separate two things that I think got bundled together > > here: not requiring a physical slot behind a compressed entry, and not > > charging the raw size to the swap counter. The first one is great, yeah, > > and it's exactly the part we want, it's what makes compression usable > > without provisioning disk. The second one is a policy change, maybe it's > > not needed for the first stage, charging a cgroup for the > > memories it has offloaded doesn't require any slot to exist behind them. > > If someone wants to run memory compression with no disk at all, > > memory.swap.max defaults to max, so that still works fine, right? > > I think what we found out over the course of this discussion is that > people have been using memory.swap.max in two ways. Regardless of what > we do, we will "break" one side. > > (1) The usecase you're describing. Use memory.swap.max, combined with > memory.max, to set a "total", predictable footprint of in-use > application address space. You can mmap whatever you want, but the > number of unique pages you can touch is limited to this sum. And you > can control residency vs non-residency through the invididual values > of those settings. If compressed entries are not included, this > usecase will break. Right, thanks for the reply! residency vs non-residency is one of the issues here. It's also about how we consider these two kind of resources to balance the scheduling of containers. > (2) The use case we have. Use memory.swap.max to divide a finite space > in storage. We only have so much space on disk, and we need to manage > fair access. Note that this isn't about speed. We have a mix of > containers where some use writeback and others do not. The ones who Same for us, the usage is mixed. > write back to the swapfile need to be able to get their fair share - > not more, not less. Including something that doesn't actually consume Is that writeback compression rate based? I mean for zswap, you have to writeback uncompressable part, and then also do cold writeback through shrinker. The compressable part is hard to predict and control though? > this separate finite resource is also a behavioral change that would > break that usecase. And arguably it's a deviation from how the control > was intended and from the broader cgroup design philosophy. > > I think we need to build tools to support both cases. But somebody > will have to change how they're doing things... :/ > In the long term we might need something like tier or xxx_ext for cgroup for better control of different resources? In either case I think if we could get the building blocks more flexible, and this actually sounds like a tiering issue? I remember Youngjun once mentioned a memcg X tier limit which sound a bit similiar.