Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] mm: vmscan: fix inverted free page check in allow_direct_reclaim()
@ 2026-11-30  6:46 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
  0 siblings, 2 replies; 3+ messages in thread
From: Zelin Deng @ 2026-11-30  6:46 UTC (permalink / raw)
  To: linux-mm, Andrew Morton; +Cc: Baolin Wang, stable, Zelin Deng

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>
---
 mm/vmscan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 851d813d0937..71f91a8a003b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -6858,7 +6858,8 @@ static bool allow_direct_reclaim(pg_data_t *pgdat)
 		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);

base-commit: 890dc639d8a33e674caa7ea9993dbd2416660447
-- 
2.43.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-01  8:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox