start_isolate_page_range(9)
πΈ start_isolate_page_range(9) πΈ
okay bestie, welcome to the Kernel API Manual π todayβs main character is start_isolate_page_range, and sheβs here to mark a page range MIGRATE_ISOLATE. no cap, stay for the details β¨
π NAME π
start_isolate_page_range β mark page range MIGRATE_ISOLATE π¦
β¨ SYNOPSIS β¨
int start_isolate_page_range (unsigned long start_pfn , unsigned long
end_pfn , enum pb_isolate_mode mode );
π ARGUMENTS π
start_pfnβ the first PFN of the range to be isolated. like, the opening act π«end_pfnβ the last PFN of the range to be isolated. the grand finale π¬modeβ isolation mode. thatβs the vibe setting, iykyk π₯
π§ DESCRIPTION π§
Making the page-allocation-type be MIGRATE_ISOLATE means free pages in the range will never be allocated. literally never, bestie π Any free pages and pages freed in the future will not be allocated again. If specified range includes migrate types other than MOVABLE or CMA, this will fail with -EBUSY. and for isolating all pages in the range finally, the caller have to free all pages in the range. test_page_isolated can be used for test it. periodt π
The function first tries to isolate the pageblocks at the beginning and end of the range, since there might be pages across the range boundaries. Afterwards, it isolates the rest of the range. itβs giving βcheck the edges first, then sweep the middleβ energy β¨
There is no high level synchronization mechanism that prevents two threads from trying to isolate overlapping ranges. If this happens, one thread will notice pageblocks in the overlapping range already set to isolate. This happens in set_migratetype_isolate, and set_migratetype_isolate returns an error. We then clean up by restoring the migration type on pageblocks we may have modified and return -EBUSY to caller. This prevents two threads from simultaneously working on overlapping ranges. so yeah, the overlapping-range drama gets shut down π«Ά
Please note that there is no strong synchronization with the page allocator either. Pages might be freed while their page blocks are marked ISOLATED. A call to drain_all_pages after isolation can flush most of them. However in some cases pages might still end up on pcp lists and that would allow for their allocation even when they are in fact isolated already. Depending on how strong of a guarantee the caller needs, zone_pcp_disable/enable might be used to flush and disable pcplist before isolation and enable after unisolation. ngl, this is the important caveat part β very much not a βset it and forget itβ vibe π
β RETURN β
0 on success and -EBUSY if any part of range cannot be isolated. slay when it works, busy-signal when it doesnβt π
π SEE ALSO π
- Kernel file
./mm/page_isolation.c isolate_single_pageblock(9)undo_isolate_page_range(9)test_pages_isolated(9)
mwah π this iconic little page comes from ./mm, dated October 2026, and itβs literally start_isolate_page_range(9). periodt π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms