hlist_add_behind_rcu(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… hlist_add_behind_rcu(9)

okay so bestie, welcome to the Kernel API Manual ✨ this is hlist_add_behind_rcu(9) and honestly she's a whole mood β€” a little RCU list-splicing icon πŸ’–


🌸 NAME

hlist_add_behind_rcu -

(yes the original really does just leave that dash hanging there with nothing after it, she's mysterious like that πŸ™ˆ we support her)


✨ SYNOPSIS

void hlist_add_behind_rcu (struct hlist_node *n , struct hlist_node
*prev );

like literally that's the whole signature, void in, two struct hlist_node * pointers, no return because she doesn't need to give anything back πŸŽ€


πŸ¦‹ ARGUMENTS

  • n β€” the new element to add to the hash list. she's the new girl, the fresh node, the main character arriving at the function 🫢
  • prev β€” the existing element to add the new element after. like she's the one already in the group chat who's gonna scoot over so n can sit next to her πŸ’…

πŸ”₯ DESCRIPTION

ngl this one is so good: it adds the specified element to the specified hlist after the specified node while permitting racing traversals ✨ that's the whole vibe β€” insert n right behind prev, and readers doing RCU traversal are not blocked, not even a little bit πŸ‘‘

BUT. and this is the important part bestie, do not skip this β€” the caller must take whatever precautions are necessary (like holding appropriate locks, for example) to avoid racing with another list-mutation primitive, such as hlist_add_head_rcu or hlist_del_rcu, running on this same list. like if two people are editing the same list at the same time it's giving chaos, it's giving undefined-adjacent heartbreak 😭 the mutation side is your problem, not hers.

However!! and this is the slay part β€” it is perfectly legal to run concurrently with the _rcu list-traversal primitives, such as hlist_for_each_entry_rcu, which are used to prevent memory-consistency problems on Alpha CPUs. so the readers can be out here doing their read-only little walk while you insert, and that's fine and correct and iconic πŸ”₯ (Alpha CPUs catching a stray mention in 2026 is so real of them πŸ’€)

tl;dr β€” mutations need your locking, traversals are free to run alongside. don't mix those two up, bestie, fr fr πŸŽ€

πŸ‘‘ SEE ALSO

Kernel file ./include/linux/rculist.h β€” plus the whole friend group:


🌈 and that's the whole page! 🫢 this one lives in ./include/linux and the manual dates it October 2026 β€” so like, future girlie behaviour, we respect it πŸ’œ mwah, go add your node behind the right prev and stay safe out there πŸŽ€β­

πŸ“¦ where this page comes from