gpu_buddy_block_trim(9)
β¨ gpu_buddy_block_trim β¨
okay bestie, welcome to the Kernel API Manual entry for gpu_buddy_block_trim(9) β yes that's the whole name, yes it's a mouthful, no we're not changing it π
πΈ NAME πΈ
gpu_buddy_block_trim β frees the pages you didn't end up needing. literally just giving unused pages their freedom π¦
π SYNOPSIS π
int gpu_buddy_block_trim (struct gpu_buddy *mm , u64 *start , u64
new_size , struct list_head *blocks );
like, that's the whole vibe check right there π
π ARGUMENTS π
mmβ the GPU buddy manager. your main character struct π«Άstartβ the start address where the trimming begins. where the glow-up starts, basically β¨new_sizeβ the original size that was requested. the size you actually wanted, before the power-of-two rounding jumped in πblocksβ input and output list of allocated blocks. this one's doing double duty, iykyk. it MUST contain a single block as input to be trimmed. on success it'll contain the newly allocated blocks making up thenew_size. and the blocks always appear in ascending order, no chaos allowed π₯
π¦ DESCRIPTION π¦
so for contiguous allocation we round the size up to the nearest power of two value. but the drivers only consume the actual size, which means the remaining portions are just sitting there unused π β and you can optionally free them with this function. it's giving "decluttering my room" energy ngl πΈ
β RETURN β
0 on success, error code on failure. that's it, that's the whole range π
π SEE ALSO π
Kernel file ./drivers/gpu/buddy.c plus all these besties:
gpu_buddy_assert(9)gpu_buddy_init(9)gpu_buddy_fini(9)gpu_buddy_reset_clear(9)gpu_buddy_free_block(9)gpu_buddy_allocated_addr_to_block(9)gpu_buddy_free_list(9)gpu_buddy_alloc_blocks(9)gpu_buddy_block_print(9)gpu_buddy_print(9)
π quick reminder bestie: the blocks list is in and out. one single block goes in, the new set of blocks comes out, ascending order, no exceptions. don't come for me, that's just what the manpage says π«Ά
and that's a wrap, queen π β this lil page lives in ./drivers/gpu and it's dated October 2026, so go forth and trim those unused pages, periodt ππ
π¦ 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