Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Joshua Hahn" <joshua.hahnjy@gmail.com>,
	"Johannes Weiner" <hannes@cmpxchg.org>
Cc: "Gregory Price" <gourry@gourry.net>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David Hildenbrand" <david@kernel.org>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Brendan Jackman" <brendan.jackman@linux.dev>,
	"Zi Yan" <ziy@nvidia.com>, "Kairui Song" <kasong@tencent.com>,
	"Qi Zheng" <qi.zheng@linux.dev>,
	"Shakeel Butt" <shakeel.butt@linux.dev>,
	"Barry Song" <baohua@kernel.org>,
	"Axel Rasmussen" <axelrasmussen@google.com>,
	"Yuanchu Xie" <yuanchu@google.com>, "Wei Xu" <weixugc@google.com>,
	"Baoquan He" <baoquan.he@linux.dev>,
	"Baolin Wang" <baolin.wang@linux.alibaba.com>,
	linux-mm@kvack.org, kernel-team@meta.com
Subject: Re: [PATCH 1/2] mm/vmscan: consolidate promo vs. high watermark checks
Date: Sat, 07 Nov 2026 17:26:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-203102@kernel.org> (raw)
In-Reply-To: <20261106172620.318113-1-joshua.hahnjy@gmail.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] mm: livelock in throttle_direct_reclaim() [1]
--

commit 577a3c6c5ce30c67e4a789965d099d1ca4f2b341
Author: Joshua Hahn <joshua.hahnjy@gmail.com>

mm/vmscan: consolidate promo vs. high watermark checks

This commit introduces kswapd_wmark_pages() to consolidate the promo vs.
high watermark selection in should_abort_scan() and pgdat_balanced().

> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 071a6eaef1a1a..97c5843e14f15 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
[ ... ]
> @@ -6966,10 +6973,7 @@ static bool pgdat_balanced(pg_data_t *pgdat, int order, int highest_zoneidx)
>  		enum zone_stat_item item;
>  		unsigned long free_pages;
>  
> -		if (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING)
> -			mark = promo_wmark_pages(zone);
> -		else
> -			mark = high_wmark_pages(zone);
> +		mark = kswapd_wmark_pages(zone);

[Severity: High]
This problem wasn't introduced by this patch, but can pgdat_balanced()
livelock with allow_direct_reclaim() in throttle_direct_reclaim()
[1] when a lower zone such as DMA has free pages above its watermark
but no reclaimable pages while higher zones are exhausted?

allow_direct_reclaim() skips zones that have free pages but no reclaimable
pages:

mm/vmscan.c:allow_direct_reclaim() {
    ...
	for_each_managed_zone_pgdat(zone, pgdat, i, ZONE_NORMAL) {
		if (!zone_reclaimable_pages(zone) &&
		    zone_page_state_snapshot(zone, NR_FREE_PAGES))
			continue;
    ...
}

When all other zones are exhausted, allow_direct_reclaim() returns false
and throttle_direct_reclaim() wakes kswapd and sleeps on
pgdat->reclaim_wait.  However, pgdat_balanced() does not skip that zone,
sees its watermark satisfied, and returns true.  balance_pgdat() then exits
without reclaiming or incrementing pgdat->kswapd_failures, so
kswapd_test_hopeless() never triggers and direct reclaimers and kswapd
wake each other in a tight loop.

[1] https://sashiko.dev/#/bug/linux-b88b79bf-7e7f-40df-b7e7-7afea197c220

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106172620.318113-1-joshua.hahnjy@gmail.com?part=1


      parent reply	other threads:[~2026-11-07 17:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 17:26 [PATCH 1/2] mm/vmscan: consolidate promo vs. high watermark checks Joshua Hahn
2026-11-06 17:26 ` [PATCH 2/2] mm/page_alloc: only skip kswapd nodes below their kswapd watermark Joshua Hahn
2026-11-06 17:50   ` Lorenzo Stoakes (ARM)
2026-11-06 18:35     ` Joshua Hahn
2026-11-07 17:26   ` sashiko-bot
2026-11-06 17:42 ` [PATCH 1/2] mm/vmscan: consolidate promo vs. high watermark checks Lorenzo Stoakes (ARM)
2026-11-06 17:50   ` Joshua Hahn
2026-11-07 17:26 ` sashiko-bot [this message]

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=sashiko-outbox-203102@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=baoquan.he@linux.dev \
    --cc=brendan.jackman@linux.dev \
    --cc=david@kernel.org \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=joshua.hahnjy@gmail.com \
    --cc=kasong@tencent.com \
    --cc=kernel-team@meta.com \
    --cc=liam@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=qi.zheng@linux.dev \
    --cc=rppt@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=weixugc@google.com \
    --cc=yuanchu@google.com \
    --cc=ziy@nvidia.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox