From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.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>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] mm: page_alloc: move capture_control to the page allocator
Date: Thu, 9 Jul 2026 22:44:04 +0200 [thread overview]
Message-ID: <a58b7bc0-be41-4689-96a2-4d6a779470a7@kernel.org> (raw)
In-Reply-To: <ak_eVpT_SpYytSSw@cmpxchg.org>
On 7/9/26 19:45, Johannes Weiner wrote:
> On Thu, Jul 02, 2026 at 12:20:48PM +0200, Vlastimil Babka (SUSE) wrote:
>> Now my version (only compile tested):
>
> Ah, now I get it. Thanks.
>
>> diff --git a/include/linux/compaction.h b/include/linux/compaction.h
>> index f29ef0653546..66a2f70e9e01 100644
>> --- a/include/linux/compaction.h
>> +++ b/include/linux/compaction.h
>> @@ -58,6 +58,7 @@ enum compact_result {
>> };
>>
>> struct alloc_context; /* in mm/internal.h */
>> +struct capture_control; /* in mm/internal.h */
>>
>> /*
>> * Number of free order-0 pages that should be available above given watermark
>> @@ -92,7 +93,7 @@ extern int fragmentation_index(struct zone *zone, unsigned int order);
>> extern enum compact_result try_to_compact_pages(gfp_t gfp_mask,
>> unsigned int order, unsigned int alloc_flags,
>> const struct alloc_context *ac, enum compact_priority prio,
>> - struct page **page);
>> + struct capture_control *capc);
>> extern void reset_isolation_suitable(pg_data_t *pgdat);
>> extern bool compaction_suitable(struct zone *zone, int order,
>> unsigned long watermark, int highest_zoneidx);
>> diff --git a/mm/compaction.c b/mm/compaction.c
>> index b7878e4a2c4b..902573797f99 100644
>> --- a/mm/compaction.c
>> +++ b/mm/compaction.c
>> @@ -2792,7 +2792,7 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)
>> static enum compact_result compact_zone_order(struct zone *zone, int order,
>> gfp_t gfp_mask, enum compact_priority prio,
>> unsigned int alloc_flags, int highest_zoneidx,
>> - struct page **capture)
>> + struct capture_control *capc)
>> {
>> enum compact_result ret;
>> struct compact_control cc = {
>> @@ -2809,36 +2809,8 @@ static enum compact_result compact_zone_order(struct zone *zone, int order,
>> .ignore_skip_hint = (prio == MIN_COMPACT_PRIORITY),
>> .ignore_block_suitable = (prio == MIN_COMPACT_PRIORITY)
>> };
>> - struct capture_control capc = {
>> - .cc = &cc,
>> - .page = NULL,
>> - };
>> -
>> - /*
>> - * Make sure the structs are really initialized before we expose the
>> - * capture control, in case we are interrupted and the interrupt handler
>> - * frees a page.
>> - */
>> - barrier();
>> - WRITE_ONCE(current->capture_control, &capc);
>>
>> - ret = compact_zone(&cc, &capc);
>> -
>> - /*
>> - * Make sure we hide capture control first before we read the captured
>> - * page pointer, otherwise an interrupt could free and capture a page
>> - * and we would leak it.
>> - */
>> - WRITE_ONCE(current->capture_control, NULL);
>> - *capture = READ_ONCE(capc.page);
>> - /*
>> - * Technically, it is also possible that compaction is skipped but
>> - * the page is still captured out of luck(IRQ came and freed the page).
>> - * Returning COMPACT_SUCCESS in such cases helps in properly accounting
>> - * the COMPACT[STALL|FAIL] when compaction is skipped.
>> - */
>> - if (*capture)
>> - ret = COMPACT_SUCCESS;
>> + ret = compact_zone(&cc, capc);
>
> &capc, and I switched it to just return compact_zone(&cc, &capc);
>
> But otherwise it looks clean to me. I'd just take this as-is with your
> From: if you don't mind. Can I add your S-O-B?
Sure, but I don't remember if I started from scratch or your version. At
least add a co-developed-by yourself or something :)
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
next prev parent reply other threads:[~2026-07-09 20:44 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-26 18:21 [PATCH 0/4] mm: fix reclaim storms in defrag_mode Johannes Weiner
2026-06-26 18:21 ` [PATCH 1/4] mm: page_alloc: __GFP_FS lockdep annotation for direct compaction Johannes Weiner
2026-07-01 13:45 ` Vlastimil Babka (SUSE)
2026-07-02 0:39 ` Shakeel Butt
2026-06-26 18:21 ` [PATCH 2/4] mm: compaction: support non-movable compaction for pageblock requests Johannes Weiner
2026-07-01 14:19 ` Vlastimil Babka (SUSE)
2026-07-01 15:28 ` Johannes Weiner
2026-07-01 18:14 ` Vlastimil Babka (SUSE)
2026-07-01 21:11 ` Johannes Weiner
2026-07-02 9:28 ` Vlastimil Babka (SUSE)
2026-07-09 17:39 ` Johannes Weiner
2026-07-09 20:42 ` Vlastimil Babka (SUSE)
2026-07-02 1:47 ` Zi Yan
2026-07-09 17:42 ` Johannes Weiner
2026-06-26 18:21 ` [PATCH 3/4] mm: page_alloc: move capture_control to the page allocator Johannes Weiner
2026-07-01 18:02 ` Vlastimil Babka (SUSE)
2026-07-01 20:57 ` Johannes Weiner
2026-07-02 10:20 ` Vlastimil Babka (SUSE)
2026-07-09 17:45 ` Johannes Weiner
2026-07-09 20:44 ` Vlastimil Babka (SUSE) [this message]
2026-06-26 18:21 ` [PATCH 4/4] mm: page_alloc: fix non-movable reclaim storm in defrag_mode Johannes Weiner
2026-06-26 18:29 ` Zi Yan
2026-06-26 18:43 ` Johannes Weiner
2026-07-01 18:06 ` Vlastimil Babka (SUSE)
2026-07-01 21:02 ` Johannes Weiner
2026-07-02 0:31 ` [PATCH 0/4] mm: fix reclaim storms " Shakeel Butt
2026-07-09 17:51 ` 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=a58b7bc0-be41-4689-96a2-4d6a779470a7@kernel.org \
--to=vbabka@kernel.org \
--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=surenb@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