From: Zelin Deng <zelin.deng@linux.alibaba.com>
To: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>,
stable@vger.kernel.org, Zelin Deng <zelin.deng@linux.alibaba.com>
Subject: [PATCH] mm: vmscan: fix inverted free page check in allow_direct_reclaim()
Date: Mon, 30 Nov 2026 14:46:52 +0800 [thread overview]
Message-ID: <20261130064652.184634-1-zelin.deng@linux.alibaba.com> (raw)
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
next reply other threads:[~2026-11-30 6:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 6:46 Zelin Deng [this message]
2026-12-01 7:31 ` [PATCH] mm: vmscan: fix inverted free page check in allow_direct_reclaim() 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130064652.184634-1-zelin.deng@linux.alibaba.com \
--to=zelin.deng@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=linux-mm@kvack.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.