Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Yoo <harry@kernel.org>
To: Qi Wu <shijing.wuqi@linux.alibaba.com>
Cc: Vlastimil Babka <vbabka@kernel.org>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	 Brendan Jackman <brendan.jackman@linux.dev>,
	Zi Yan <ziy@nvidia.com>,
	 Mel Gorman <mgorman@techsingularity.net>,
	linux-mm@kvack.org
Subject: Re: [PATCH] mm: page_alloc: do not capture HIGHATOMIC pages
Date: Mon, 30 Nov 2026 15:56:32 +0000	[thread overview]
Message-ID: <aw2YvsxiydxuBY4B@thinkstation> (raw)
In-Reply-To: <20261129142350.123923-1-shijing.wuqi@linux.alibaba.com>

On Sun, Nov 29, 2026 at 10:23:50PM +0800, Qi Wu wrote:
> compaction_capture() filters CMA and isolated pages but not
> MIGRATE_HIGHATOMIC. A captured page bypasses the buddy freelists, so it
> escapes the ALLOC_HIGHATOMIC check in rmqueue_buddy() and the
> nr_free_highatomic watermark accounting: a plain blocking allocation
> can consume a page reserved for atomic allocations. HIGHATOMIC pages
> reach the hook through PCP drains, which re-read the pageblock type
> before calling __free_one_page().
> 
> The gap has existed since capture was introduced; commit 7e8756d7ad22
> ("mm: page_alloc: fix non-movable reclaim storm in defrag_mode")
> widened it by sending non-movable order-0 allocations through direct
> compaction when defrag_mode is enabled.
> 
> Refuse HIGHATOMIC pages like CMA. The page then enters the freelists
> and the allocation falls back to get_page_from_freelist(), where the
> reserve checks apply.
> 
> Found and drafted with AI assistance (Qoder); build-tested only.

The idea of this patch makes sense to me, but would you please at least
try to reproduce the problem before claiming it _fixes_ the problem :)

> Fixes: 5e1f0f098b46 ("mm, compaction: capture a page under direct compaction")
> Cc: stable@vger.kernel.org

... especially when backporting a patch to -stable.

> Signed-off-by: Qi Wu <shijing.wuqi@linux.alibaba.com>
> ---
>  mm/page_alloc.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 2fef4092c913..4443d715df2d 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -735,6 +735,10 @@ compaction_capture(struct capture_control *capc, struct page *page,
>  	    is_migrate_isolate(migratetype))
>  		return false;
>
> +	/* HIGHATOMIC pages are reserved for atomic allocations. */
> +	if (migratetype == MIGRATE_HIGHATOMIC)
> +		return false;
> +
>  	/*
>  	 * Do not let lower order allocations pollute a movable pageblock
>  	 * unless compaction is also requesting movable pages.
> 
> base-commit: 4f069ab1ec243e6b60dc438772905855c60774e8
> 
> Notes (not part of the commit log):
> - Checked against akpm mm-unstable (890dc639d8a3): compaction_capture()
>   is identical there. The in-flight freetype_t rework and the
>   "claim blocks captured for non-movable use" RFC touch this function
>   but are not queued yet, so this applies cleanly to both trees.
> - The hit rate of this path can be observed with the
>   mm_page_alloc_extfrag tracepoint (fallbackmt=HIGHATOMIC).
> -- 
> 2.47.3

-- 
Cheers,
Harry / Hyeonggon


      reply	other threads:[~2026-11-30 15:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 14:23 [PATCH] mm: page_alloc: do not capture HIGHATOMIC pages Qi Wu
2026-11-30 15:56 ` Harry Yoo [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=aw2YvsxiydxuBY4B@thinkstation \
    --to=harry@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=brendan.jackman@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=shijing.wuqi@linux.alibaba.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --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