From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.175 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796413460; b=nPpA5eeu+vMcQtZXHd0csKLRiR81m2OQDrBOW3wTkdrUsSg/GR7uIFcn2MAuIeUzEya+ qnuEL8ZbS6TGVQbIA1oxUjdZFtVLrKFBCWNpyV8CPK2hdUVjbIp9VxG88LPIpTgzDli1/ +eu16i9PEDAsrjXOVXKDmuJKznBq/ozI041kY2TmZC7EmwExj5hxSqAaXYyDfSBwbOwNZ geTByI/STUOwCoG7NmdsGLRnrYdlczjlp72Ahzp/vHlyLwIbfPiogP3bkztaAE8kbjUyw PfK+cWMioezz8dtdCVAoCEyWKQt/kW+2LQryrJkOSsY6VOXeqvu6r3sK2uSj6OrrkHA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796413460; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:Content-Transfer-Encoding: In-Reply-To; bh=L0fNvtPEN5CTbmnrKUGEGY9uS7zufaxf96c+iJlh7KE=; b=HX1EHbx+qLy6zebXsMyLfy8L0nWMr94uxVOA+q4YOkm+iQEZ4c9S5/XFWMGl62KYf2g3 sOXzpOnS2duWadAcqFnqulIwJAldZgJjujJIkt53qFgqa+yI6WbU712QT5pegHSpbfRBO 01rNdonFo92BLLI4xC0ZmoC8cFYBsnVStFHRLUxQAPxw1zglcPKfX+KMGXa/lquxbEc5I kRZS8PZBJ4tWoCqsi7tF6SuEChX3GKce8ewcontK7N9BjiCnl8DBFRtRyMf5LtbPPdNAO jwdBiRYTPh9FtEfjBqXd5pqqrUWbQMzvhGGc+OAvVmZ2vKPcVBixu+W3/h0SplOrWkA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass header.d=cmpxchg.org header.i=@cmpxchg.org header.a=rsa-sha256 header.s=google header.b=NBIITo+I; arc=none smtp.remote-ip=209.85.128.175 Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27381606A32F for ; Fri, 4 Dec 2026 19:44:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 27381606A32F 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.a=rsa-sha256 header.s=google header.b=NBIITo+I Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-8b4e04eda5aso9339897b3.1 for ; Fri, 04 Dec 2026 11:44:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1796413458; x=1797018258; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding: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=L0fNvtPEN5CTbmnrKUGEGY9uS7zufaxf96c+iJlh7KE=; b=NBIITo+IYyhPFVfOqj8jVX/8pVgaRDipUoxYrLGHK8Sr8qfQZK6PmivxgyNr8OyJRD MhdAl/PRr6JVvwQuXVydVjNyMdrqE/9glEBK2679/JxMEzr/hm70/A/6/cowLdln6cI8 VYR7e2NwL7qy0Gq1flc0eJNVs0Oc9bmaYGf03Jp2/AAItl/CyvCkP2vTlRyG32kbYW2g STkyP7NrwEc7ZaanqJN4cutbwpOXmctxUZsObnqsAGBZG+3RDuOlt6DAuevVpCrh65n3 DPUfUXNb4BnfUvN1vWSpTyoHI0o+9+k2EzUAkMvSdiqOWEBSGhBp/uGMOF5ll5SNoUh/ RGfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796413458; x=1797018258; h=in-reply-to:content-transfer-encoding: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=L0fNvtPEN5CTbmnrKUGEGY9uS7zufaxf96c+iJlh7KE=; b=p94byS84J0e4DKx19MDwv1AZiFGOg/5trPpHcpTbuu+T1Hpm0OsorpL+2GFdQLM2tQ leqqfPikdIGOSffF7acXvi1+gR4jNch9JewCbP7b/ZJIrdNBlOZ+pSd9MAOz6xcqpFrh AZXAjE/IgoUlrW+mY9CtObD01uEjmeBjpJenjC6Vl5hYo8hqz9I4GbISWG7KsIsTHZKx Nl4fEddCoFilsHSuy7ZS8Qen9TSFJZXyTjUNtX08Ly3NcqMn9t22DcfU+yD2iBV4HNLo 00nTmPFsHXZwfuTf+ygwe29Jh8DNgAmjNge7VjIsr+kUOKla1mmQReq/PepHzHSzHwu1 5BFQ== X-Forwarded-Encrypted: i=1; AL+hErE2B6C2aKbCqNpmOrYP/ev1Zssy/LAgQAyxzAcuH4arwIwmSadRnKf/rIlMGvUiKsjxM0okgUfqjCDI1f0=@vger.kernel.org X-Gm-Message-State: AB4q+uGukn2CA+1KN8itDHbtgeBU/OQMGbku9K/J6wU1iBXCb+B2nhpY 8XjBfXk34noDy9eFtOAMb5NRsd4xeo9WAXiCqD2s9UGA63567EVzrKUb/JeASiTJKco= X-Gm-Gg: AZFdTZe25EfTLhwalJV296EBoi9+En0ACZR3W3IQtViNOV4DVOd9VWc9RozR8L5WSsV l5uwnTGb0u2bBdMQhi/tfCf6sWKvnK3yckDJkHQ2PQ1/DuC77dXuxt8hr+MNkju1p3qiB3oR5c7 307d02LwDAgGdWz02Uesy7ZPiHg0CJL4EiBsdbLnjjUwAqEjwdRmcjLul+wipIOvc90JfZdzhdc Mx0AXWFWJmgHP/skEE1Q6LqHystrWUBKAGLlQSz6QjUzH41gX2vtgPlSc9zvbAQhDwpW4byEAnB P8U/6IpelFMaL2khN/pFvPcKiMH7e66HJnsoCh0JOZG4nUoI97ak4nbkx4atAcey+IrTvPXzgGN Kco5gThT/hiKfFDPtelhbwM5hhh9QjqeUmsj6f0F7Ht1rwNbGjBFwlUt+o9RJ/o9NttJyE4biKH 7o5b0PS0eB1QlNAznTr82fq4TXC0k5UPdvc9GsQz2xcFAL3dWgwKOp02uGMBiq3czzg8u0+NMCv y0d2xtQaYKhY4u/zJS9+PS9tI44cZLGrfq4B1x6F6rDAGxIRArqhDDE8oiNO9LT3BOwauL2arqD alavzXXs54HTFv9j24Jx8ELoIDw= X-Received: by 2002:a05:690c:7344:b0:8b3:be52:9832 with SMTP id 00721157ae682-8b660df2a37mr17782487b3.43.1796413457979; Fri, 04 Dec 2026 11:44:17 -0800 (PST) Received: from localhost ([2605:8600:200:dc6:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b660e10477sm13901007b3.43.2026.12.04.11.44.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 11:44:17 -0800 (PST) Date: Fri, 4 Dec 2026 14:44:13 -0500 From: Johannes Weiner To: Nhat Pham Cc: Chris Li , Kairui Song , "David Hildenbrand (Arm)" , Baoquan He , Michal Hocko , Roman Gushchin , Shakeel Butt , 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 , Gregory Price , Wenchao Hao , Jonathan Corbet , Hugh Dickins , Baolin Wang , Tejun Heo , Michal =?iso-8859-1?Q?Koutn=FD?= , Shuah Khan , Kunwu Chan , Meta kernel team , Linux Memory Management List , Linux Kernel Mailing List , "open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)" , Andrew Morton , Joshua Hahn , Rik van Riel , Wei Xu , Yosry Ahmed Subject: Re: Virtual Swap Sync Message-ID: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, Dec 04, 2026 at 11:30:46AM -0700, Nhat Pham wrote: > On Tue, Dec 1, 2026 at 10:27 PM Chris Li wrote: > > > > On Mon, Nov 30, 2026 at 4:26 AM Nhat Pham wrote: > > > Ah I see. It's logical footprint, but enforced on an allocation/used > > > basis rather than mapping (i.e address space reservation, which > > > existing vm.overcommit modes regulate). > > > > > > I think swap sizing is still the wrong interface for this. IMHO, it's > > > a crude emulation, with some downsides: > > > > > > Say the desired logical memory limit is 4GB. We have 2GB of physical > > > memory limit, so we emulate that by setting swap size to 2GB. Now say > > > I have a hot file cache of 1GB, and 3GB of cold anon. That should be > > > allowed, but you'd thrash prematurely or OOM because you can only > > > > I think you and Kairui have different requirement and assumption in mind. > > You seem to want the maximum compression. (Max memory savings). > > Kairui's usage case cares about the consistency serving quality by > > limiting the total amount of swap (a bounded performance penalty > > caused by swap). My read is that, page faults have a much higher > > access latency than RAM. He is trading less memory saving for more > > consistent run time behavior. The compression ratio is determined by > > the workload, which lacks consistency from a job scheduling > > perspective; he does not want a high compression ratio if it causes > > too many page faults in the worst-case scenario, which would impact > > serving performance. It is OK to OOM there, because if you have too > > much swap, your worst-case performance is trashed anyway. In this case > > the solution is to increase RAM not increase the swap limit. > > > > Both requirements can be valid use cases. > > Yes, my personal use case is closer to the second one (maximum > compression), but I'm actually describing both use cases here, and I > think static sizing interface seems wrong for both. > > For the first use case, gating phys mem and gating swap size > separately is not the same as gating "logical memory footprint". It's > essentially the equivalent of using memory.max and memory.swap.max to > simulate memsw. It's not quite accurate tbh. That's is my point. The > user is only still using 4GB, logically speaking (1GB file and 3GB of > anon). We're violating that guarantee, because we give the host 2GB of > memory and 2G of offload capability, which fails to serve 4GB because > we incorrectly predict the split. IIRC, Kairui mentioned in the first meeting that he tried emulating his usecase exactly this way in cgroup2 and it didn't work. Kairui, please correct me if I misremember. IMO, the best option is still a transparent virtualization layer at the bottom. And an optional control plane on top for those who care. One that actually fits the usecase, doesn't get in the way of those who do not want it, and composes well with the rest of the kernel. I know I've said this a few times without offering a concrete proposal. But I'm also in the camp of people who do not care. I worked with everyone who thought they had such a case at my company to switch to psi-based utilization control, and still think this is a better use of resources. It would be good for those who have that "fixed cloud capacity" case to lay it out cleanly and help design a solution. It shouldn't be a vswap blocker. This is as incremental as it gets. No memsw setup is broken, no zram setup is broken.