per_cpu_ptr_to_phys(9)
π 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:
pcpu_addr_in_chunk(9)pcpu_check_block_hint(9)pcpu_next_md_free_region(9)pcpu_next_fit_region(9)pcpu_mem_zalloc(9)pcpu_mem_free(9)pcpu_chunk_relocate(9)pcpu_block_update(9)pcpu_chunk_refresh_hint(9)pcpu_block_refresh_hint(9)pcpu_block_update_hint_alloc(9)pcpu_block_update_hint_free(9)pcpu_is_populated(9)pcpu_find_block_fit(9)pcpu_alloc_area(9)pcpu_free_area(9)pcpu_alloc_first_chunk(9)pcpu_chunk_populated(9)pcpu_chunk_depopulated(9)pcpu_chunk_addr_search(9)pcpu_alloc(9)pcpu_balance_free(9)pcpu_balance_populated(9)pcpu_reclaim_populated(9)pcpu_balance_workfn(9)free_percpu(9)is_kernel_percpu_address(9)pcpu_alloc_alloc_info(9)pcpu_free_alloc_info(9)pcpu_dump_alloc_info(9)pcpu_setup_first_chunk(9)pcpu_build_alloc_info(9)pcpu_embed_first_chunk(9)pcpu_page_first_chunk(9)
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
- 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