From: Daniil Tatianin <d-tatianin@yandex-team.ru>
To: "David Hildenbrand (Arm)" <david@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Brendan Jackman <brendan.jackman@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page_alloc: don't undo another caller's pageblock isolation
Date: Wed, 18 Nov 2026 13:26:57 +0300 [thread overview]
Message-ID: <464d793e-19e5-42d2-b695-c8124fbb9b34@yandex-team.ru> (raw)
In-Reply-To: <17456889-f94b-438f-85b3-45e9d51272ee@kernel.org>
On 11/18/26 12:50 PM, David Hildenbrand (Arm) wrote:
> On 11/18/26 01:00, Daniil Tatianin wrote:
>> start_isolate_page_range() fails with -EBUSY when a pageblock in the
>> range is already isolated, after it has undone the isolation it did
>> itself. Commit 2c7452a075d4 ("mm/page_isolation.c: make
>> start_isolate_page_range() fail if already isolated") made it work this
>> way, so that users of overlapping ranges, such as CMA, memory offlining
>> and gigantic hugetlb pages, can use pageblock isolation to stay out of
>> each other's way.
>>
>> Since commit b2c9e2fbba32 ("mm: make alloc_contig_range work at
>> pageblock granularity"), alloc_contig_frozen_range() handles this
>> failure by jumping to its common exit path, which calls
>> undo_isolate_page_range() on the whole range. What is still isolated
>> there at this point belongs to the other user, so this takes the
>> isolation away while that user is still working on the pageblock. The
>> page allocator can then hand out its free pages again.
>>
>> Return right away instead, like offline_pages() does when
>> start_isolate_page_range() fails.
>>
>> Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity")
>> Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
>> ---
>> mm/page_alloc.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 12fac9084c48..151a8d64783d 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -7335,8 +7335,9 @@ int alloc_contig_frozen_range_noprof(unsigned long start, unsigned long end,
>> */
>>
>> ret = start_isolate_page_range(start, end, mode);
>> + /* After a failure, whatever is still isolated belongs to someone else */
>> if (ret)
>> - goto done;
>> + return ret;
>>
>> drain_all_pages(cc.zone);
>>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7d9c29ed8feec8bfbe5e5f673ba2b5926da11375
Oops, my bad, should've checked. Thanks
prev parent reply other threads:[~2026-11-18 10:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 0:00 Daniil Tatianin
2026-11-18 9:50 ` David Hildenbrand (Arm)
2026-11-18 10:26 ` Daniil Tatianin [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=464d793e-19e5-42d2-b695-c8124fbb9b34@yandex-team.ru \
--to=d-tatianin@yandex-team.ru \
--cc=akpm@linux-foundation.org \
--cc=brendan.jackman@linux.dev \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.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
all inboxes | Powered by JetHome®