mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gregory Price <gourry@gourry.net>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 Vlastimil Babka <vbabka@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	 Michal Hocko <mhocko@suse.com>,
	Brendan Jackman <jackmanb@google.com>, Zi Yan <ziy@nvidia.com>,
	 David Hildenbrand <david@kernel.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	 "Liam R . Howlett" <liam@infradead.org>,
	Mike Rapoport <rppt@kernel.org>,
	 Shakeel Butt <shakeel.butt@linux.dev>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/4] mm: page_alloc: move capture_control to the page allocator
Date: Wed, 22 Jul 2026 12:59:22 -0400	[thread overview]
Message-ID: <amDyzpXQirujriAk@gourry-fedora-PF4VCD3F> (raw)
In-Reply-To: <20260722150006.3848560-4-hannes@cmpxchg.org>

On Wed, Jul 22, 2026 at 10:56:46AM -0400, Johannes Weiner wrote:
> From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
> 
> The compaction capturing code assumes the allocation request order and
> compaction target order are the same. That won't be true once
> defrag_mode promotes sub-block allocations to pageblock-order
> compaction: compaction targets the larger order, while capture should
> remain at the original allocation order.
> 
> Move the capture_control to the page allocator and give it its own
> copies of what the page freeing path matches against - zone, migratetype
> and the allocation order - rather than reaching into compaction's live
> compact_control. __alloc_pages_direct_compact() fills in migratetype and
> order, and installs and hides current->capture_control around the whole
> compaction call; try_to_compact_pages() aims capc->zone at each zone
> while it is being compacted. compact_zone_order() no longer deals with
> capture at all.
> 
> Pass the capture_control through try_to_compact_pages() /
> compact_zone_order() in place of the bare struct page **.
> 
> No functional change.
> 
> Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
> Co-developed-by: Johannes Weiner <hannes@cmpxchg.org>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  include/linux/compaction.h |  3 ++-
>  mm/compaction.c            | 50 +++++++++++---------------------------
>  mm/internal.h              |  4 ++-
>  mm/page_alloc.c            | 45 ++++++++++++++++++++++++++++------
>  4 files changed, 57 insertions(+), 45 deletions(-)
>
... snip ... 
> +		WRITE_ONCE(capc->zone, zone);
> +
>  		status = compact_zone_order(zone, order, gfp_mask, prio,
> -				alloc_flags, ac->highest_zoneidx, capture);
> +				alloc_flags, ac->highest_zoneidx, capc);
> +
> +		WRITE_ONCE(capc->zone, NULL);
> +
> +		/* Stop if a page has been captured */
> +		if (READ_ONCE(capc->page))
> +			status = COMPACT_SUCCESS;
> +

Might be worth a comment to explain what the WRITE/READ once is dealing
with here since it's now detached from the main barrier(), but otherwise

Reviewed-by: Gregory Price <gourry@gourry.net>

  reply	other threads:[~2026-07-22 16:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 14:56 [PATCH v2 0/4] mm: fix reclaim storms in defrag_mode Johannes Weiner
2026-07-22 14:56 ` [PATCH v2 1/4] mm: page_alloc: __GFP_FS lockdep annotation for direct compaction Johannes Weiner
2026-07-22 14:56 ` [PATCH v2 2/4] mm: compaction: support non-movable compaction for pageblock requests Johannes Weiner
2026-07-22 16:23   ` Gregory Price
2026-07-22 14:56 ` [PATCH v2 3/4] mm: page_alloc: move capture_control to the page allocator Johannes Weiner
2026-07-22 16:59   ` Gregory Price [this message]
2026-07-22 14:56 ` [PATCH v2 4/4] mm: page_alloc: fix non-movable reclaim storm in defrag_mode Johannes Weiner
2026-07-22 17:10   ` Brendan Jackman
2026-07-22 23:22   ` Andrew Morton
2026-07-23 10:22     ` Vlastimil Babka (SUSE)
2026-07-23 14:08       ` Johannes Weiner
2026-07-23 14:17         ` Vlastimil Babka (SUSE)
2026-07-24  0:02           ` Andrew Morton
2026-07-24  5:58             ` Greg Kroah-Hartman
2026-07-24  0:00       ` Andrew Morton
2026-07-23 15:13   ` Vlastimil Babka (SUSE)
2026-07-24 15:09   ` Brendan Jackman
2026-07-24 18:07     ` Johannes Weiner
2026-07-25 12:34   ` Brendan Jackman
2026-07-27 16:50     ` Johannes Weiner

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=amDyzpXQirujriAk@gourry-fedora-PF4VCD3F \
    --to=gourry@gourry.net \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --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

Powered by JetHome