From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (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 71CDC2BF3D7 for ; Thu, 23 Jul 2026 02:00:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784772027; cv=none; b=m6LNj4Qn1fozksMN7fq0UUjP3cOiithly/z1Uq/k8srzgWgH0K/PQrGcrLXz3TkFcTN5QpUtKKPXo6wJs4snnrKgtrSiHkfL9EJArOLwx01R8EnFVfIt9G7RtuDZ8iqiTh2FYClSgT5EmPgPBf2K1yBDHdcudfKfjniIJnnnh7U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784772027; c=relaxed/simple; bh=eBuvfGEPatJQZ5SLxYiwxylyB3vuS9wcgQLRlHOt6vQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=s2QOgeogmLQs/MZR1pezzC6NlXsMtPHp8TC9A75OFov+X2zCtzx0IxewiLVbrx/BD1NKA8j0dP1meucIY5EJpbcAYwh/DBHhhvIVTiN62+g7sRo+W05S/dN7SlTiR/7jNvPEH2ebJ6rFLA0DSY7vVjLxIzUQvYuPOHGgwuM4bNI= 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=q1upDwdl; arc=none smtp.client-ip=91.218.175.181 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="q1upDwdl" Message-ID: <52f41904-d6fb-46b9-9e89-296cda0a988b@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1784772021; 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=RtZKpBojyVkCJ2vB47fWFj5D6zB1GFGL23zh19aZDtI=; b=q1upDwdl6/ue9tdjrtLUVw1GKKwC4/LsLsDDk6KE1XA8HH6XMP/OzA9p3xxQCCjCwNM16b YPHcz9dPzMvOGxemOyQ1W3O3bs330krkWM9lVB+G8w7zRGxz2ZqiExz6GFuTIzNVRZZppM qS+5PQwg0tNCQP/7l2YQWcK8J7LakqE= Date: Thu, 23 Jul 2026 09:59:45 +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 1/4] mm/vmscan: fix anon-only reclaim evicting file pages when swappiness=max To: Barry Song Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, david@kernel.org, mhocko@kernel.org, qi.zheng@linux.dev, 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-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/21/2026 3:45 PM, Barry Song wrote: > On Mon, Jul 20, 2026 at 12:43 PM Ridong Chen wrote: > [...] > >>>> --- a/mm/vmscan.c >>>> +++ b/mm/vmscan.c >>>> @@ -2501,6 +2501,17 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, >>>> enum scan_balance scan_balance; >>>> enum lru_list lru; >>>> >>>> + /* Proactive reclaim initiated by userspace for anonymous memory only */ >>>> + if (swappiness == SWAPPINESS_ANON_ONLY) { >>>> + WARN_ON_ONCE(!sc->proactive); >>> >>> I feel it's a bit odd that the WARN_ON_ONCE() is placed here. Maybe >>> adding a short comment would make the intent clearer. For example: >>> "SWAPPINESS_ANON_ONLY is only allowed for proactive reclaim." >> >> Hi Barry, >> >> I didn't change the original logic in this patch. I agree that adding a >> comment would help clarify the intent. >> >> I'll include that in the next version. >> >>> I'm not sure whether it would be better to issue this warning earlier, >>> for example in try_to_free_mem_cgroup_pages(). That said, I don't >>> feel strongly about this. >> >> Since patch 4 will address the MGLRU issue and could also include this >> warning, I think that triggering the warning earlier makes sense and >> would be more general. Would it be acceptable to add a separate patch >> (e.g., patch 5) for moving the warning? That way, each patch stays >> focused on a single logical change. > > I'm not quite sure where the best place would be to move it earlier. We > already have two places that perform proactive reclaim: > try_to_free_mem_cgroup_pages() and __node_reclaim(). There are also > other reclaim paths that are not proactive. Since they all eventually call > shrink_node(), would it make more sense to handle it there? > > If we can't find a suitable common path, I guess simply adding some comments > to the current patches would be good enough. > Eh, shrink_node handles MGLRU global reclaim via a special branch, so we'd have to add the warning at the beginning of shrink_node, but that feels a bit jarring. Let's just go with adding some comments instead. -- Best regards Ridong