get_pfnblock_migratetype(9)
π get_pfnblock_migratetype(9) β a Kernel API Manual moment
okay so bestie, welcome to the <pink>Kernel API Manual</pink> β¨ today's main character is get_pfnblock_migratetype and honestly she's lowkey iconic for how much work she saves you π«Ά
πΈ NAME πΈ
get_pfnblock_migratetype β returns the migratetype of a pageblock π that's it, that's the vibe check
β¨ SYNOPSIS β¨
enum migratetype get_pfnblock_migratetype (const struct page *page ,
unsigned long pfn );
look at her signature, so clean, so demure π
π¦ ARGUMENTS π¦
pageβ the page that lives inside the block you're curious about π she's your "where am I" coordinatepfnβ the target page frame number π― literally the number, the pfn in question
β RETURN β
the migratetype of the pageblock π« that's what you get back, no cap
π DESCRIPTION π
okay so here's the tea: use get_pfnblock_migratetype when you, the caller, already have both page and pfn sitting right there in your hands π because then you get to skip a whole page_to_pfn call β and honestly? saving a call like that is so satisfying, it's giving efficiency, it's giving "I already did the work" ππ₯
π₯ SEE ALSO π₯
the friend group π all of these live in the Kernel file ./mm/page_alloc.c and honestly they're all worth a follow:
__get_pfnblock_flags_mask(9)get_pfnblock_bit(9)__set_pfnblock_flags_mask(9)set_pfnblock_bit(9)clear_pfnblock_bit(9)set_pageblock_migratetype(9)__move_freepages_block_isolate(9)__putback_isolated_page(9)__free_pages(9)free_pages(9)alloc_pages_exact(9)alloc_pages_exact_nid(9)free_pages_exact(9)nr_free_zone_pages(9)nr_free_buffer_pages(9)find_next_best_node(9)free_reserved_pages(9)setup_per_zone_wmarks(9)__free_contig_range(9)alloc_contig_frozen_range(9)alloc_contig_range(9)alloc_contig_frozen_pages(9)alloc_contig_pages(9)free_contig_frozen_range(9)free_contig_range(9)alloc_pages_nolock(9)
and that's the whole page, bestie, you ate that π source is ./mm, version date October 2026, and yes it's still called get_pfnblock_migratetype(9) because legends don't change their names ππ
bye mwah π
π¦ 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