* [PATCH] mm/page_alloc: don't undo another caller's pageblock isolation
@ 2026-11-18 0:00 Daniil Tatianin
2026-11-18 9:50 ` David Hildenbrand (Arm)
0 siblings, 1 reply; 3+ messages in thread
From: Daniil Tatianin @ 2026-11-18 0:00 UTC (permalink / raw)
To: Andrew Morton, Vlastimil Babka
Cc: Daniil Tatianin, Suren Baghdasaryan, Michal Hocko,
Brendan Jackman, Johannes Weiner, Zi Yan, David Hildenbrand,
linux-mm, linux-kernel
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);
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] mm/page_alloc: don't undo another caller's pageblock isolation
2026-11-18 0:00 [PATCH] mm/page_alloc: don't undo another caller's pageblock isolation Daniil Tatianin
@ 2026-11-18 9:50 ` David Hildenbrand (Arm)
2026-11-18 10:26 ` Daniil Tatianin
0 siblings, 1 reply; 3+ messages in thread
From: David Hildenbrand (Arm) @ 2026-11-18 9:50 UTC (permalink / raw)
To: Daniil Tatianin, Andrew Morton, Vlastimil Babka
Cc: Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
Johannes Weiner, Zi Yan, linux-mm, linux-kernel
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
--
Cheers,
David
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] mm/page_alloc: don't undo another caller's pageblock isolation
2026-11-18 9:50 ` David Hildenbrand (Arm)
@ 2026-11-18 10:26 ` Daniil Tatianin
0 siblings, 0 replies; 3+ messages in thread
From: Daniil Tatianin @ 2026-11-18 10:26 UTC (permalink / raw)
To: David Hildenbrand (Arm), Andrew Morton, Vlastimil Babka
Cc: Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
Johannes Weiner, Zi Yan, linux-mm, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-18 10:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 0:00 [PATCH] mm/page_alloc: don't undo another caller's pageblock isolation Daniil Tatianin
2026-11-18 9:50 ` David Hildenbrand (Arm)
2026-11-18 10:26 ` Daniil Tatianin
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®