From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) (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 A4CC878F2E for ; Mon, 20 Jul 2026 02:49:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784515769; cv=none; b=Xw7Z2YDMqWYgoc2g6GSqZQ4SlrKuHPCdxOr00UIHemRAFUM957bzU7LCnidu03WuygjI4tg9vrbcj5t9wG0I57oBtGgK22OOqD25boh84vSgZSeezNH/AtUdKvoBXUpuL6fX2S/AwgcnwKV2enHF6Dmn8gkbaRO7Xeg7knZADFQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784515769; c=relaxed/simple; bh=ea59cfTrCSsJJpgclPWXREfwZ0kYAURNoklpxR3X1jw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=m8Tyc9YlIZtcpZg7sP1LLs29YFcGlEcoi80Lqf41VneQkG+ndk9Vz2y/OcADYDEbYz0BEYdoxQ9paqBDVMHAbLdOjBqXS2AcKMu8HLsWG7uo2CKVJ0jVtl55ejAHpi8gxhiGSn3fp2NY8tphi1bixe9MfhFNt6Y1DALJYcGyhFY= 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=tU9U/1Xc; arc=none smtp.client-ip=95.215.58.170 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="tU9U/1Xc" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1784515765; 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=UieMaWjn37WtAKNVXeqODJ/nhyQJ2CNCH8qbQcNSy/k=; b=tU9U/1XcgGuRl/BZsM6szx+/SfKqjPtWrOEOswY01Srt4EvRzFDjuQMwhQJ+r0a1MpyQmU 3VqRuFqoXLf6VUpG/5Ypzb3BZKz1gEIj3LUS1K+y+ButvYzn1Nreyl+ePLt0EaLVeyLgrf iWjYjL6wtw3KHFcGOqwl7C3io2OtSfg= Date: Mon, 20 Jul 2026 10:48:56 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2 4/4] mm/mglru: fix anon-only reclaim evicting file pages when swappiness=max To: Barry Song , Ridong Chen Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, david@kernel.org, mhocko@kernel.org, shakeel.butt@linux.dev, ljs@kernel.org, kasong@tencent.com, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, hezhongkun.hzk@bytedance.com, muchun.song@linux.dev, dave@stgolabs.net, roman.gushchin@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ridong Chen References: <20260718095251.82937-1-ridong.chen@linux.dev> <20260718095251.82937-5-ridong.chen@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Qi Zheng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 7/18/26 9:43 PM, Barry Song wrote: > On Sat, Jul 18, 2026 at 5:54 PM Ridong Chen wrote: >> >> From: Ridong Chen >> >> The previous patch fixes this issue for the traditional LRU, which also >> exists in MGLRU [1]. Fix this by checking whether swappiness is >> SWAPPINESS_ANON_ONLY in get_swappiness() first, and returning 0 from >> get_nr_to_scan() when swappiness is SWAPPINESS_ANON_ONLY and anon pages >> cannot be reclaimed, to avoid useless work. > > Is this intended to avoid unnecessary work, or to prevent file folios > from being reclaimed incorrectly? Based on the test results below, it seems primarily intended to prevent file pages from being mistakenly reclaimed. Also, bailing out early in the SWAPPINESS_ANON_ONLY + !can_reclaim_anon_pages case is to avoid unnecessary work. Hi Ridong, perhaps the commit message could be clearer. ;) > >> >> The test result: >> Before fix: >> >> # cat /sys/kernel/mm/lru_gen/enabled >> 0x0007 >> # cat memory.stat >> anon 204800 >> file 67108864 >> ... >> pgsteal_proactive 0 >> pgscan_proactive 0 >> >> # echo "64M swappiness=max" > memory.reclaim >> # cat memory.stat >> anon 208896 >> file 0 >> ... >> pgsteal_proactive 16384 >> pgscan_proactive 16384 >> >> After fix: >> >> # cat memory.stat >> anon 188416 >> file 67215360 >> kernel 1970176 >> ... >> pgsteal_proactive 0 >> pgscan_proactive 0 >> >> # echo "64M swappiness=max" > memory.reclaim >> -bash: echo: write error: Resource temporarily unavailable >> # cat memory.stat >> anon 204800 >> file 67215360 >> ... >> pgsteal_proactive 0 >> pgscan_proactive 0 >> >> [1] https://sashiko.dev/#/patchset/20260717113300.214717-1-ridong.chen@linux.dev >> >> Fixes: 68a1436bde00 ("mm: add swappiness=max arg to memory.reclaim for only anon reclaim") >> Signed-off-by: Ridong Chen >> --- >> mm/vmscan.c | 14 +++++++++++++- >> 1 file changed, 13 insertions(+), 1 deletion(-) >> Overall, this looks good to me. Acked-by: Qi Zheng Thanks, Qi