alloc_rtree_node(9)
π alloc_rtree_node β Kernel API Manual vibes β¨
okay so bestie, you're in the Kernel API Manual and today's main character is alloc_rtree_node(9). buckle up π
πΈ NAME πΈ
alloc_rtree_node β allocate a brand new node and, like, add it to the radix tree. that's the whole job. she's employed π
β¨ SYNOPSIS β¨
struct rtree_node * alloc_rtree_node (gfp_t gfp_mask , int safe_needed ,
struct chain_allocator *ca , struct list_head *list );
literally just call her with those four things and she'll hand you back a struct rtree_node *, no cap π«Ά
π¦ ARGUMENTS π¦
gfp_maskβ the GFP mask for the allocation. it's giving "how hard should I try to get memory" energy.safe_neededβ get pages that haven't been used before hibernation. restore only, so don't be weird about it π this one's niche.caβ a pointer to a linked list of pages (yep, a "chain") that we allocate from. it's giving actual chain, not the cute necklace kind πlistβ the Radix Tree node to add. she gets appended, periodt.
π DESCRIPTION π
so what does she actually do? bestie. she's the one who allocates inner nodes and the leave nodes of the radix tree β both, iconic versatility π
and then, because she's not just pretty, she also adds the node to the corresponding linked list that got passed in through the *list parameter. multitasking queen fr fr π
π₯ SEE ALSO π₯
kernel file ./kernel/power/snapshot.c β that's where the whole friend group lives:
get_image_page(9)free_image_page(9)free_mem_extents(9)create_mem_extents(9)memory_bm_next_pfn(9)mark_nosave_pages(9)create_basic_memory_bitmaps(9)free_basic_memory_bitmaps(9)snapshot_additional_pages(9)count_free_highmem_pages(9)count_highmem_pages(9)count_data_pages(9)swsusp_free(9)preallocate_image_pages(9)free_unnecessary_pages(9)minimum_image_size(9)hibernate_preallocate_memory(9)pack_pfns(9)snapshot_read_next(9)unpack_orig_pfns(9)count_highmem_image_pages(9)prepare_highmem_image(9)copy_last_highmem_page(9)prepare_image(9)snapshot_write_next(9)restore_highmem(9)
like, the entire group chat. go read them, iykyk π
ngl if you're poking at hibernation/snapshot code, you're in ./kernel/power territory β that's the address on the mailbox, bestie π‘
so yeah, that's the whole page π shoutout to the ./kernel/power source, dated October 2026, for being the origin of all this. mwah, love u, bye ππ
π¦ 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