From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (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 5E9006FC3 for ; Tue, 28 Jul 2026 01:03:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785200603; cv=none; b=dVFbS3upws3SxHPDAdAXfQFIYK1HhrDvFouDvjhdJseHnHnrhNx3HP5jBk+0BGBGTQ5TEgy4dO89dFSAcuRYO4BVDw/Jd65Wk1PT93+USCfeVeJPN6sl4/r4eyjWQtfb9VwwzzxytrHrsfBLB6h00YRD/WbKL16zRd/s96Bi2X8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785200603; c=relaxed/simple; bh=DQvrFtWi8SlKe0YX4sBYKKfmRjl5jRpP+2sZAe+TjZ4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OlQO91rxJ8R/VoX5Pl2ZBdxHYZKRtg+BNgWlbCuxJJ0zm6gHQRcJntyJ7HNFhtmiZQDqcs2+xC32p+EwNidYLQo9+4j0oYilyK5NBdpoN90JdCxiq/7hgcliCKmyXQRP3NBtLzgFh4qVKP1vih2oRwNeDCxxyFYj6HIf19E+L5c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=NY0BAgM8; arc=none smtp.client-ip=95.215.58.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="NY0BAgM8" Message-ID: <2fd4c2f8-3166-4432-9192-17bdb2627138@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785200596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wskNm12QGMqSlQDsZWZfrxXV4LbUJu7o+wO+yhTqD8o=; b=NY0BAgM8ZYRyHEtVSJnSxYsA8oND9tMbRYWjMGqQgKKbBhOc47onOqDXLYqHhavVdTRBPJ gPrmHk7FdAfxf7/+tTdUxGZoQSQ5YGGdevEyDulT5HwCQlktNJaX6tD9rlr9J2G27mNZfR rP8dquj0rs/LejZ6vxumLi9h5kBPGHs= Date: Tue, 28 Jul 2026 09:02:58 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH -v4 1/4] mm/vmscan: fix anon-only reclaim evicting file pages when swappiness=max To: Barry Song , Michal Hocko Cc: Andrew Morton , Johannes Weiner , David Hildenbrand , Qi Zheng , Shakeel Butt , Lorenzo Stoakes , Kairui Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Zhongkun He , Muchun Song , Davidlohr Bueso , Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ridong Chen References: <20260724033435.2573323-1-ridong.chen@linux.dev> <20260724033435.2573323-2-ridong.chen@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Ridong Chen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 7/27/2026 6:56 PM, Barry Song wrote: > On Mon, Jul 27, 2026 at 4:19 PM Michal Hocko wrote: >> >> On Fri 24-07-26 11:34:32, Ridong wrote: >>> From: Ridong Chen >>> >>> As Qi mentioned [1], when swappiness=max (SWAPPINESS_ANON_ONLY) is set, >>> the reclaim logic is expected to reclaim anonymous pages exclusively. >>> However, due to the current ordering of checks in get_scan_count(), >>> file pages may still be evicted if can_reclaim_anon_pages() returns >>> false, which contradicts the semantics of SWAPPINESS_ANON_ONLY. >> >> But if can_reclaim_anon_pages tells us that anonymous pages are not >> reclaimable then it makes no sense to try that, no? What do you expect >> to see? An OOM killer? > > This is proactive reclaim rather than direct reclaim, and > SWAPPINESS_ANON_ONLY is only supported for proactive reclaim. It > therefore cannot invoke the OOM killer. > > If I understand correctly, this is exactly the issue this patch is > trying to address. Instead of falling back to reclaiming file folios, > it returns "bash: echo: write error: Resource temporarily unavailable". > > After (file cache is left intact): > # cat memory.stat > anon 200704 > file 67178496 > pgscan_proactive 0 > # echo "64M swappiness=max" > memory.reclaim > -bash: echo: write error: Resource temporarily unavailable > # cat memory.stat > anon 208896 > file 67178496 <- page cache untouched > pgsteal_proactive 0 > pgscan_proactive 0 > > Ridong, please correct me if I am wrong. Thank you, Barry, it's correct. -- Best regards Ridong