radix_tree_replace_slot(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… radix_tree_replace_slot πŸ’…

okay so bestie, this is radix_tree_replace_slot(9) from the Kernel API Manual, and it's giving β€œtiny function, very serious locking rules.” No cap, it's a quick little slot-swap situation with a big warning label. ✨


πŸŽ€ NAME πŸŽ€

radix_tree_replace_slot β€” replace item in a slot


✨ SYNOPSIS ✨

void radix_tree_replace_slot (struct radix_tree_root *root , void __rcu
       **slot , void *item );

🌸 ARGUMENTS 🌸

  • root β€” the radix tree root. the main character of this whole tree situation. πŸ‘‘
  • slot β€” pointer to slot. literally the slot pointer, bestie. πŸ’…
  • item β€” the new item to store in the slot. yes, the fresh thing going in there. πŸŽ€

πŸ¦‹ DESCRIPTION πŸ¦‹

This one is for use with radix_tree_lookup_slot and radix_tree_gang_lookup_tag_slot. 🫢

The caller must hold the tree write locked across the slot lookup and the replacement. not optional, not β€œoops I forgot,” not a vibe. hold that write lock the whole time. πŸ”’


⚠️ NOTE ⚠️

This cannot be used to switch between non-entries (empty slots), regular entries, and value entries, because that requires accounting inside the radix tree node. 😭

When switching from one type of entry or deleting, use __radix_tree_lookup and __radix_tree_replace or radix_tree_iter_replace. periodt. πŸ’€


πŸ”— SEE ALSO πŸ”—

Kernel file ./lib/radix-tree.c


mwah πŸ’– that's the whole page, bestie. source is ./lib, and the date/version vibe is October 2026 β€” go forth and replace those slots responsibly. 🧚🌸

πŸ“¦ where this page comes from