pcpu_build_alloc_info(9)
β¨ pcpu_build_alloc_info(9) β¨
okay bestie, welcome to the Kernel API Manual π«Ά this one's literally about building an alloc_info while being super aware of how far apart your CPUs are from each other. distance-aware king behavior, no cap π
πΈ NAME πΈ
pcpu_build_alloc_info β build alloc_info considering distances between CPUs
π SYNOPSIS π
struct pcpu_alloc_info * pcpu_build_alloc_info (size_t reserved_size ,
size_t dyn_size , size_t atom_size , pcpu_fc_cpu_distance_fn_t
cpu_distance_fn );
π ARGUMENTS π
reserved_sizeβ literally the size of the reserved percpu area, in bytes πdyn_sizeβ the minimum free size for dynamic allocation, in bytes β¨atom_sizeβ the allocation atom size πcpu_distance_fnβ the callback that figures out the distance between cpus. it's optional, so no pressure bestie π¦
π DESCRIPTION π
so the way this works: it determines the grouping of units, their mappings to cpus, and all the other parameters β and it does it while considering the needed percpu size, the allocation atom size, and the distances between CPUs. it's giving β¨thoughtfulβ¨
groups are always multiples of atom size, and CPUs that are of LOCAL_DISTANCE both ways get grouped together and share space for units in the same group. cute, right? π₯°
and the returned configuration is guaranteed to have CPUs on different nodes on different groups, plus >=75% usage of the allocated virtual address space. we love an efficient queen π
β RETURN β
- on success β a pointer to the new
allocation_infois returned π - on failure β an
ERR_PTRvalue is returned π
π₯ SEE ALSO π₯
kernel file ./mm/percpu.c, then the whole friend group:
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), per_cpu_ptr_to_phys(9), pcpu_alloc_alloc_info(9), pcpu_free_alloc_info(9), pcpu_dump_alloc_info(9), pcpu_setup_first_chunk(9), pcpu_embed_first_chunk(9), pcpu_page_first_chunk(9)
okay that's the whole page, you ate that fr fr π
β¨ this little gem lives over in ./mm and it's stamped October 2026 β until next time bestie, 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