per_cpu_ptr_to_phys(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME πŸ’…

okay so bestie, this is per_cpu_ptr_to_phys(9) from the Kernel API Manual β€” and it does exactly one iconic thing: it converts a translated percpu address into a physical address. no cap. 🫢

✨ SYNOPSIS ✨

phys_addr_t per_cpu_ptr_to_phys (void *addr );

πŸŽ€ ARGUMENTS πŸŽ€

  • addr β€” the address you want converted to a physical address. that’s the whole assignment, queen. πŸ’…

πŸ”₯ DESCRIPTION πŸ”₯

so like, you hand it addr β€” a dereferenceable address you got from one of the percpu access macros β€” and this function translates it into its physical address. the caller is responsible for making sure addr stays valid until this function finishes. don’t be messy about it. 😭

the percpu allocator has special setup for the first chunk. currently that first chunk supports either embedding in linear address space or vmalloc mapping, and from the second one onward, the backing allocator (currently either vm or km) provides translation. it’s giving layered infrastructure, fr fr. πŸ¦‹

addr could be translated simply without checking if it falls into the first chunk. but the current code reflects better how percpu allocator actually works, and the verification can discover both bugs in percpu allocator itself and per_cpu_ptr_to_phys callers. so we keep current code. periodt. πŸ’€

πŸ‘‘ RETURN πŸ‘‘

the physical address for addr. that’s it, that’s the reward. πŸŽ€

🌈 SEE ALSO 🌈

Kernel file ./mm/percpu.c β€” and okay bestie, here’s the full squad, no one left behind:


okay that’s the page, bestie β€” source/version: ./mm; date: October 2026; page: per_cpu_ptr_to_phys(9) β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from