__radix_tree_create(9)
π __radix_tree_create (9) β kernel API manual, bestie edition π
okay so this page is from the Kernel API Manual, and ngl it's a good one. we're creating slots in radix trees. it's giving data-structure main character energy β¨
πΈ NAME πΈ
__radix_tree_create β create a slot in a radix tree π¦
β¨ SYNOPSIS β¨
int __radix_tree_create (struct radix_tree_root *root , unsigned long
index , struct radix_tree_node **nodep , void __rcu ***slotp );
no cap, that's the whole signature. four args, one int back. she's neat like that π
π ARGUMENTS π
rootβ the radix tree root, aka where the whole tree starts. the source of truth πindexβ the index key. this is which spot we're talking about, iykyk πnodepβ a return slot that hands you back the node π«Άslotpβ a return slot that hands you back the slot π
(yes, both of those are out params. you're getting stuff back, not just shoving stuff in. love that for us)
π DESCRIPTION π
So the whole vibe: this function creates, if necessary, and returns the node and the slot for an item sitting at position index in the radix tree root. literally creating and handing back at the same time. versatile queen π
β¨
here's the fun part β and lowkey this is the important part β until there is more than one item in the tree, no nodes are allocated at all. instead, root->xa_head gets used as a direct slot rather than pointing to a node. and in that case, *nodep will be NULL. so if you're checking *nodep and it's NULL, that's not a bug, that's just the early-tree era π§ half of you is gonna be like "why is it NULL" and the answer is "because the tree is baby." periodt.
β οΈ okay warning time bestie:*nodepcan legitimately beNULLin the single-item case described above. don't go dereferencing it without a vibe check, fr fr π
Return value: -ENOMEM, or 0 for success. that's it, those are the options. 0 = slay, -ENOMEM = the allocator said no π
π¦ SEE ALSO π¦
Kernel file ./lib/radix-tree.c, plus the entire friend group β this list is long and we are not skipping anybody. every single one of these, in order, no cuts:
radix_tree_find_next_bit(9)radix_tree_shrink(9)radix_tree_insert(9)__radix_tree_lookup(9)radix_tree_lookup_slot(9)radix_tree_lookup(9)__radix_tree_replace(9)radix_tree_replace_slot(9)radix_tree_iter_replace(9)radix_tree_tag_set(9)radix_tree_tag_clear(9)radix_tree_iter_tag_clear(9)radix_tree_tag_get(9)radix_tree_next_chunk(9)radix_tree_gang_lookup(9)radix_tree_gang_lookup_tag(9)radix_tree_gang_lookup_tag_slot(9)radix_tree_iter_delete(9)radix_tree_delete_item(9)radix_tree_delete(9)radix_tree_tagged(9)idr_preload(9)idr_destroy(9)
twenty-three entries. the whole squad got invited to the group chat π
okay and finally, the sign-off πΈ: this one lives in ./lib (that's the source section), and it's dated October 2026. so likeβ¦ future girl summer for the manpage π
π go forth and create your slots, bestie, you're gonna ate this π«Άβ¨
π¦ 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