isolate_migratepages_block(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’… isolate_migratepages_block(9) โ€” from the Kernel API Manual

okay so bestie, picture this: you're deep in mm/compaction.c and you need to pull out every page in a little chunk of memory that's actually down to move. that's this function. it's giving "surgical page extraction" and honestly? iconic. โœจ


๐ŸŒธ SYNOPSIS

int isolate_migratepages_block (struct compact_control *cc , unsigned long low_pfn , unsigned long end_pfn , isolate_mode_t mode );

๐ŸŽ€ ARGUMENTS

  • cc โ€” the compaction control structure, aka the main character. it holds all the state for the whole operation ๐Ÿซถ
  • low_pfn โ€” the very first PFN you wanna isolate. the starting line ๐Ÿ“
  • end_pfn โ€” the one-past-the-last PFN to isolate, and no cap, it has to be within the same pageblock ๐Ÿšง
  • mode โ€” the isolation mode to be used. pick your vibe ๐ŸŒˆ

๐Ÿ’– DESCRIPTION

so what it does is isolate all the pages that can be migrated from the range [low_pfn, end_pfn). and when we say range, we mean it โ€” that bad boy is expected to live inside the same pageblock, fr fr.

it returns an errno, like:

  • -EAGAIN or -EINTR โ€” in case e.g. a signal is pending or there's congestion ๐Ÿ˜ญ
  • -ENOMEM โ€” in case we could not allocate a page ๐Ÿ’€
  • 0 โ€” the good ending โœจ

also important, don't skip this: cc->migrate_pfn will contain the next pfn to scan. so you always know where to pick back up ๐Ÿ‘‘

the pages get isolated onto the cc->migratepages list โ€” and lowkey note this โ€” that list is not required to be empty, so don't come for it. and cc->nr_migratepages gets updated accordingly, because numbers gotta stay honest ๐Ÿงฎ


๐Ÿฆ‹ SEE ALSO


bestie reminder: the range being inside the same pageblock isn't a suggestion, it's the whole assignment. treat it with respect ๐Ÿ™ˆ

kisses from the ./mm directory, version dated October 2026 โ€” isolate_migratepages_block(9), you will always be famous ๐Ÿ’œ๐ŸŽ€

๐Ÿ“ฆ where this page comes from