walk_memory_blocks(9)
π walk_memory_blocks β the Kernel API Manual, bestie edition π
okay so real talk, the function we're talking about here is walk_memory_blocks(9) β that's the whole header, manual name Kernel API Manual and all, and she's lowkey iconic. let's get into it π
β¨ NAME β¨
walk_memory_blocks β she walks through all present memory blocks overlapped by the range [start, start + size). that's it, that's the job, and she does it flawlessly fr fr π¦
πΈ SYNOPSIS πΈ
int walk_memory_blocks (unsigned long start , unsigned long size , void
*arg , walk_memory_blocks_func_t func );
yes bestie, the spacing is exactly like that, don't come for me, that's how it's printed π
π ARGUMENTS π
startβ the start address of the memory range. where the lil adventure begins π©sizeβ size of the memory range. how far we're roaming fromstartπargβ the argument passed tofunc. the little care package handed to your callback πfuncβ the callback for each memory section walked. your main character function that gets called on every block π«
π₯ DESCRIPTION π₯
so here's the tea β: this function walks through all present memory blocks overlapped by the range [start, start + size), calling func on each memory block. one by one, no block left behind, we love a thorough queen π
and if func returns an error? walking is aborted and that error gets returned right back at you. no cap, she's not gonna keep strolling after a callback says nope π
π«Ά heads up bestie: this whole thing is called under device_hotplug_lock. lock awareness is a vibe, respect it.
π¦ SEE ALSO π¦
she lives in the kernel file ./drivers/base/memory.c, and here's her whole friend group, all (9) sections, all iconic:
memory_block_advise_max_size(9)memory_block_advised_max_size(9)memory_block_add_nid_early(9)for_each_memory_block(9)memory_group_register_static(9)memory_group_register_dynamic(9)memory_group_unregister(9)
and that's the page, bestie! β¨ sign-off time: this lil beauty comes to you from ./drivers/base, dated October 2026 β go off, kernel docs, 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