walk_memory_blocks(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ‘‘ 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 from start πŸ“
  • arg β€” the argument passed to func. 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:


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