From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (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 B5BFC5D8F0 for ; Thu, 29 Jan 2026 02:48:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769654910; cv=none; b=K5voldW5dzFuYwTE4Qqr9WyGyzN1CLC4qXEICAcoUcZnfDZA06h7uycin/TMtSRxdoiyVRYyZqP1r+i7YgEMam/oac+DIO2tNml74JaTL4iAt3R/eaPwBL4slO9EDdJ+SghndWHIT6rcL9DSIMeLBip3cvPTQH6MxPnRhIcoL9E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769654910; c=relaxed/simple; bh=MSegS80E30k4pDG+GLAY/UU/gkkjDOslUAcbbqkcFEY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RbZPBmM+XZHYWN8Zz7k06KoVmYWLepzhkWiNj3H0gBdpBGfSVs6w3rmuhKCSZmk+RSZq4GL4wVF0yu0hEWenBxzAwRvE9fzATe4ooAM2W+vB8eDqF9zWD/ia11SCh1DYP7dPgAAizftg0GX5Zz4yRE9AbzbvwbFcKT7dQJzfL1E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=BgVt4uNg; arc=none smtp.client-ip=209.85.222.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="BgVt4uNg" Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-8c6d76b9145so57066685a.2 for ; Wed, 28 Jan 2026 18:48:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1769654901; x=1770259701; 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=logWgHGlCER7wF/d1bfHjZorFrIMr5ik74BP+Q9xdGQ=; b=BgVt4uNgSawbWr6aN5HnkCdTelXAWLKTHq55Td5arp6lLdRdcLgIauD2vWGfPFIEpJ rn9+g2kQ0aPftObvlKr3AAtQolheV+M31cfsHOXdTSjfi7wThm5xpCc2+gXyXPpn55DG YZ8Sxgprh8PxMcDrKiawBmBq87p+XIBHdZAQd2QQ4qPVwWRo4mClX/l8rqI/P3kRaGjX Xbx9q43UI36sVzAmExhntmNn5YzIrVcmBDoXQ4/eynvQedgGFKpZ/x3TWRgPY1ZDqXg2 zOlB6xuODT+iVHEtLkj7xDq6lQMzL6mzR2p5q0dG9RRKReSnTz3BNfjOpgqcKYGPAH1b cniA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769654901; x=1770259701; 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=logWgHGlCER7wF/d1bfHjZorFrIMr5ik74BP+Q9xdGQ=; b=VPqxa0jUBmFizIxHL2uxMdfItTs0nbo1eYcKwZ19QHcw6WX7Fosrb0TZOWFh0H5lww ivdYL4wUDp2LOTvo82InwgbijedQlGNQpxM7rLfDVu9tYfZmzH+7R4ZEMxrw5qZGjcba YU8hbx8Z7rdisJjE227Yl+lbosQ7NO4Iw7UmEdYfvsdy+tcworH4QYzXI1PPfMPDNUYt oTDxrTe2h/ypDlpNC1j86Dl+o4ytUs8WxiiaGHT50a4fllHBBw9evAATk1Df0sKn8Xxv WsCdYj6yVhyQP6ftVdpxog9ltwozXeL+KaacGrVh87Girm4Jmj1P0sR8cwVZFargmH1e vQVA== X-Forwarded-Encrypted: i=1; AJvYcCXpCajJkYq5DBFjKS2sP3PdbTKPueTCQFZHUfAHRQMd+czHT47DTDZD5tCdtHVa8Roz2XVNok74ENLnl4c=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8pw6gtphN66vxGJxhCc/Q4WIXj20P8vgg5CggO+UxQWoNJ1XE yZX2wd5JWviA6C88E5LeMwRv2UPvKT0DoUI2dSj9XoqGJGwJ8cjN1BqdA/ZlcbtPcEg= X-Gm-Gg: AZuq6aL6eAWsxtyoxhikOHhPUWloc+vBNh9PqgcsdL6qf4h6bi5ODMTrFKFzlE22DLo Ql02w2sCB44dQNDht9rF953hM4sZQ0EtD4zB+dtfE17IdgUHG1YIQe7SvG5KNOw9NR7USuEUsOW Ump9H2hRfu2epQ/LPjsfq99Y2Mq2sVDnJN8o60x0JKphF5+B0gWrs8cQj7m5SVo9yTDuxTxCyYv 2eUgmKYxjswUldMr4vh3FBN9wnDrg0Vnx3ppgWiSrhnVeNUkihEodjKrYnr/KfIoTrjPTYryc80 ZjwAwD18ChXHyzyhDVsp5FQDnjQXmqOcf09lxzVVOsgY8pJu2XzR79HCmakO1QPn6CI3+yAeIBp OxR+AYWyQXv7EctbtoArI7t+6MLv0nupNqbrqAfkHWDi4TME11cp9qvezNnsHHOTBO25mu9r6xJ lrrJ2dijjSMgDWdb++Ev+9gcx+nZRQI9y7bw7dwiB3jZC5ajHrSjYYEK1uAGqfIcyl0t4lE28Ik okKaH09 X-Received: by 2002:a05:620a:444b:b0:8c5:310d:3b2a with SMTP id af79cd13be357-8c70b86793amr829909085a.19.1769654900885; Wed, 28 Jan 2026 18:48:20 -0800 (PST) Received: from gourry-fedora-PF4VCD3F (pool-96-255-20-138.washdc.ftas.verizon.net. [96.255.20.138]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c711b7d169sm305514085a.4.2026.01.28.18.48.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jan 2026 18:48:20 -0800 (PST) Date: Wed, 28 Jan 2026 21:48:18 -0500 From: Gregory Price To: Akinobu Mita Cc: Michal Hocko , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, hannes@cmpxchg.org, david@kernel.org, zhengqi.arch@bytedance.com, shakeel.butt@linux.dev, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, ziy@nvidia.com, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, ying.huang@linux.alibaba.com, apopple@nvidia.com, bingjiao@google.com, jonathan.cameron@huawei.com, pratyush.brahma@oss.qualcomm.com Subject: Re: [PATCH v4 3/3] mm/vmscan: don't demote if there is not enough free memory in the lower memory tier Message-ID: References: <20260113081453.8293-4-akinobu.mita@gmail.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: On Thu, Jan 29, 2026 at 09:51:44AM +0900, Akinobu Mita wrote: > > I'm not sure there's a best-option here, we may need additional input to > > determine what the least-worst option is. Causing LRU inversion when > > all the nodes are pressured but swap is available is not preferable. > > Would it be better if can_demote() returned false after checking that > there is no free swap space at all and that there is not enough free space > on the demote target node or its lower nodes? > I need some time to think on this. If we take your patch, I think we essentially default to the same behavior as-if demotion was wholesale disabled in the first place - toptier nodes would reclaim space directly into swap. zswap would probably get skipped if we're already in direct reclaim (if we can't allocate a page, neither can zswap). The alternative is reclaim makes absolutely no progress, even if there is (z)swap space available - which is essentially what you're experiencing. Maybe there is an argument for simply falling back to swap if there's no room on any node further away. Will ponder this for a bit and get back to you. ~Gregory