* Re: [PATCH] mm: vmscan: fix inverted free page check in allow_direct_reclaim()
2026-11-30 6:46 [PATCH] mm: vmscan: fix inverted free page check in allow_direct_reclaim() Zelin Deng
@ 2026-12-01 7:31 ` Baolin Wang
2026-12-01 8:28 ` + mm-vmscan-fix-inverted-free-page-check-in-allow_direct_reclaim.patch added to mm-new branch Andrew Morton
1 sibling, 0 replies; 3+ messages in thread
From: Baolin Wang @ 2026-12-01 7:31 UTC (permalink / raw)
To: Zelin Deng, linux-mm, Andrew Morton,
hannes@cmpxchg.org >> Johannes Weiner, Kairui Song
Cc: stable, Qi Zheng, Michal Hocko, Shakeel Butt, Barry Song,
Axel Rasmussen, Yuanchu Xie, Wei Xu, Baoquan He
CC more relevant people
On 11/30/26 2:46 PM, Zelin Deng wrote:
> Commit 4bd22a7ae574 ("mm: fix duplicate accounting of free pages in
> should_reclaim_retry()") removed the free-page fallback from
> zone_reclaimable_pages() and added an explicit check in
> allow_direct_reclaim().
>
> Before that change, allow_direct_reclaim() skipped a zone only when it had
> neither reclaimable nor free pages. The new check was inverted: it skips a
> zone when it has no reclaimable pages but does have free pages. It also
> keeps a zone that has neither, adding its watermark without adding any free
> pages.
>
> As a result, allow_direct_reclaim() can keep returning false and leave
> direct reclaimers throttled even though free pages are available.
>
> Negate the free-page test to restore the previous behavior while keeping
> free pages out of zone_reclaimable_pages().
>
> Fixes: 4bd22a7ae574 ("mm: fix duplicate accounting of free pages in should_reclaim_retry()")
> Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Zelin Deng <zelin.deng@linux.alibaba.com>
> ---
The fix looks good to me.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* + mm-vmscan-fix-inverted-free-page-check-in-allow_direct_reclaim.patch added to mm-new branch
2026-11-30 6:46 [PATCH] mm: vmscan: fix inverted free page check in allow_direct_reclaim() Zelin Deng
2026-12-01 7:31 ` Baolin Wang
@ 2026-12-01 8:28 ` Andrew Morton
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2026-12-01 8:28 UTC (permalink / raw)
To: mm-commits, yuanchu, weixugc, stable, shakeel.butt, qi.zheng,
mhocko, liuqiqi, kasong, hannes, baoquan.he, baolin.wang, baohua,
axelrasmussen, zelin.deng, akpm
The patch titled
Subject: mm: vmscan: fix inverted free page check in allow_direct_reclaim()
has been added to the -mm mm-new branch. Its filename is
mm-vmscan-fix-inverted-free-page-check-in-allow_direct_reclaim.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-vmscan-fix-inverted-free-page-check-in-allow_direct_reclaim.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Zelin Deng <zelin.deng@linux.alibaba.com>
Subject: mm: vmscan: fix inverted free page check in allow_direct_reclaim()
Date: Mon, 30 Nov 2026 14:46:52 +0800
Commit 4bd22a7ae574 ("mm: fix duplicate accounting of free pages in
should_reclaim_retry()") removed the free-page fallback from
zone_reclaimable_pages() and added an explicit check in
allow_direct_reclaim().
Before that change, allow_direct_reclaim() skipped a zone only when it had
neither reclaimable nor free pages. The new check was inverted: it skips
a zone when it has no reclaimable pages but does have free pages. It also
keeps a zone that has neither, adding its watermark without adding any
free pages.
As a result, allow_direct_reclaim() can keep returning false and leave
direct reclaimers throttled even though free pages are available.
Negate the free-page test to restore the previous behavior while keeping
free pages out of zone_reclaimable_pages().
Link: https://patch.msgid.link/20261130064652.184634-1-zelin.deng@linux.alibaba.com
Fixes: 4bd22a7ae574 ("mm: fix duplicate accounting of free pages in should_reclaim_retry()")
Signed-off-by: Zelin Deng <zelin.deng@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: liuqiqi <liuqiqi@kylinos.cn>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Qi Zheng <qi.zheng@linux.dev>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Kairui Song <kasong@tencent.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Cc: Wei Xu <weixugc@google.com>
Cc: Baoquan He <baoquan.he@linux.dev>
Cc: <stable@vger.kernel.org>
mm/vmscan.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/mm/vmscan.c~mm-vmscan-fix-inverted-free-page-check-in-allow_direct_reclaim
+++ a/mm/vmscan.c
@@ -6940,7 +6940,8 @@ static bool allow_direct_reclaim(pg_data
return true;
for_each_managed_zone_pgdat(zone, pgdat, i, ZONE_NORMAL) {
- if (!zone_reclaimable_pages(zone) && zone_page_state_snapshot(zone, NR_FREE_PAGES))
+ if (!zone_reclaimable_pages(zone) &&
+ !zone_page_state_snapshot(zone, NR_FREE_PAGES))
continue;
pfmemalloc_reserve += min_wmark_pages(zone);
_
Patches currently in -mm which might be from zelin.deng@linux.alibaba.com are
mm-vmscan-fix-inverted-free-page-check-in-allow_direct_reclaim.patch
^ permalink raw reply [flat|nested] 3+ messages in thread