pcpu_alloc_first_chunk(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ pcpu_alloc_first_chunk ✨

okay so this is a page from the Kernel API Manual, and it's all about pcpu_alloc_first_chunk β€” the little function that gets the very first percpu chunk situation sorted πŸ’…


πŸ’– NAME πŸ’–

pcpu_alloc_first_chunk β€” creates chunks that serve the first chunk πŸŽ€ (yes bestie, chunks that serve the first chunk, that's literally the whole vibe)


🌸 SYNOPSIS 🌸

struct pcpu_chunk * pcpu_alloc_first_chunk (unsigned long tmp_addr , int
map_size );

like, it hands you back a struct pcpu_chunk * and it wants a tmp_addr and a map_size, no cap 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • tmp_addr β€” the start of the region served. that's the address where the whole thing begins ✨
  • map_size β€” size of the region served. how big the region is, obviously πŸ’«

πŸ”₯ DESCRIPTION πŸ”₯

So this function is responsible for creating the chunks that serve the first chunk β€” main character energy, it's building the foundation for everything else fr fr πŸ‘‘

Here's the tea: base_addr is page aligned down of tmp_addr, while the region end is page aligned up. And then offsets are kept track of to determine the region served. The way this matters is that all of this is done to appease the bitmap allocator 😭 β€” specifically, to keep it from dealing with partial blocks. no partial blocks, not today, not ever πŸ™ˆ


⭐ RETURN ⭐

A chunk serving the region at tmp_addr of map_size. that's it, that's the give-back πŸ’–


πŸ’œ SEE ALSO πŸ’œ

Kernel file ./mm/percpu.c β€” and bestie, the cross-references are stacked, look at this whole roster πŸ‘‘


okay that's the whole page, you ate that πŸ’… and before you go β€” the little sign-off at the bottom says this one lives in ./mm, dated October 2026, and it's filed under pcpu_alloc_first_chunk(9). slay, go read the source, ily bye πŸ§šπŸ’œ

πŸ“¦ where this page comes from