pcpu_find_block_fit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ pcpu_find_block_fit(9) ✨

okay so bestie, we're deep in the Kernel API Manual and this little icon is pcpu_find_block_fit(9). no cap, it's the function that picks where to start hunting for a free region πŸ’…


🌸 NAME 🌸

pcpu_find_block_fit β€” finds the block index to start searching πŸŽ€

✨ SYNOPSIS ✨

int pcpu_find_block_fit (struct pcpu_chunk *chunk , int alloc_bits ,
       size_t align , bool pop_only );

πŸŽ€ ARGUMENTS πŸŽ€

  • chunk β€” chunk of interest. your main-character chunk, basically 🫢
  • alloc_bits β€” size of request in allocation units. the size bestie πŸ“
  • align β€” alignment of area (max PAGE_SIZE bytes). yes, max PAGE_SIZE bytes ✨
  • pop_only β€” use populated regions only. no empty-vibes regions allowed πŸ™ˆ

πŸ¦‹ DESCRIPTION πŸ¦‹

Given a chunk and an allocation spec, find the offset to begin searching for a free region. This iterates over the bitmap metadata blocks to find an offset that will be guaranteed to fit the requirements.

It is not quite first fit: if the allocation does not fit in the contig hint of a block or chunk, it is skipped. This errs on the side of caution to prevent excess iteration. Poor alignment can cause the allocator to skip over blocks and chunks that have valid free areas 😭

πŸ”₯ RETURN πŸ”₯

The offset in the bitmap to begin searching. -1 if no offset is found. that's the whole mood πŸ’€

πŸ’– SEE ALSO πŸ’–

the whole percpu extended universe is pulling up:

Kernel file ./mm/percpu.c 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_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_build_alloc_info(9),
pcpu_embed_first_chunk(9),
pcpu_page_first_chunk(9)

xoxo, your percpu bestie πŸ’– β€” source ./mm, October 2026 edition πŸŽ€

πŸ“¦ where this page comes from