rb_add_cached(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 rb_add_cached(9) 🌸

okay so bestie, welcome to the Kernel API Manual β€” yes, THE kernel API manual, we're in the big leagues now πŸ’… this one's about rb_add_cached(9), and it's lowkey one of the most satisfying little helpers in the whole tree. sit down, hydrate, let's go 🫢


✨ NAME ✨

rb_add_cached β€” insert @node into the leftmost cached tree @tree πŸŽ€

like, that's literally the whole vibe. you have a node, you have a cached tree, you put the node in the tree. slay.


πŸ’– SYNOPSIS πŸ’–

void rb_add_cached (struct rb_node *node , struct rb_root_cached *tree ,
bool (*less)(struct rb_node *, const struct rb_node *) );

ok so look at this signature, it's giving very demure very mindful β€” returns void, takes three things, no cap. the (*less) function pointer is the main character here, iykyk 🌈


πŸ¦‹ ARGUMENTS πŸ¦‹

  • node β€” the node you wanna insert πŸ“ this is the little guy going into the tree, treat it nice.
  • tree β€” the leftmost cached tree you're inserting node into 🌳 it's cached, it's leftmost, it's iconic, it's exactly what it says on the tin.
  • less β€” the operator that defines the (partial) node order ⭐ note the word partial, bestie, we're not out here assuming a total order, that's not the assignment. this bad boy is bool (*less)(struct rb_node *, const struct rb_node *) and it decides who goes where.

πŸ’€ SEE ALSO πŸ’€

the receipts, in original order, no edits fr fr πŸ‘‘

like, the whole rbtree friend group showed up to the function. obsessed πŸ”₯


ngl the only thing better than reading the manpage is reading the actual header file, so go click on ./tools/include/linux/rbtree.h when you're done here πŸ™ˆ

okay that's the whole page, mwah πŸ’‹ this cutie came to you from ./tools/include/linux, dated October 2026 β€” mark your calendars, screenshot it, frame it, whatever, periodt πŸ§šβ€β™€οΈβœ¨

πŸ“¦ where this page comes from