hlist_nulls_...ace_init_rcu(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME πŸ’…

ok so bestie, this one is hlist_nulls_replace_init_rcu β€” it replaces an old entry with a new one and initializes the old one, all in one lil move ✨ (this is from the Kernel API Manual, in case the vibe check was unclear 🫢)


πŸ¦‹ SYNOPSIS πŸ¦‹

void hlist_nulls_replace_init_rcu (struct hlist_nulls_node *old , struct hlist_nulls_node *new );

like literally that's it, void in, no return value out, no drama πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • old β€” the element that's getting replaced πŸ‘‹ she's being swapped out, and she's also getting initialized by the end of this, so don't be shocked
  • new β€” the shiny new element to insert in her place πŸ‘‘ main character energy fr fr

🌸 DESCRIPTION 🌸

So here's the tea, bestie β˜• β€” this function replaces the old entry with the new one inside a RCU-protected hlist_nulls, and it does it while allowing racing traversals to keep happening 😭 like nobody has to stop walking the list, it's giving "smooth operator", it's giving "no locks dropped", periodt.

And then β€” because it's not done slaying β€” it reinitializes the old entry too. Two jobs, one function, iconic behavior ngl πŸ’…βœ¨


⚠️ NOTE ⚠️

old must be hashed. like for real, no cap, that's not optional πŸ™ˆ

The caller has to take whatever precautions are necessary (such as holding appropriate locks) to avoid racing with another list-mutation primitive running on this same list β€” think stuff like hlist_nulls_add_head_rcu or hlist_nulls_del_rcu πŸ’€ do NOT let two mutators scrap over the same list, that's not the vibe.

BUT β€” and this is the fun part πŸŽ‰ β€” it is perfectly legal to run concurrently with the _rcu list-traversal primitives, such as hlist_nulls_for_each_entry_rcu. Traversals? oh they can vibe alongside you all day, that's literally the whole point πŸ§šπŸ’œ


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./include/linux/rculist_nulls.h πŸ“ and all her friends:

go read them, they're all icons, iykyk ⭐


okok that's the whole thing bestie, mwah πŸ’– this lil gem lives over in ./include/linux πŸ“‚, dated October 2026, and it's filed under hlist_nulls_...ace_init_rcu(9) β€” go forth and replace responsibly, and remember: lock it before you rock it πŸŽ€πŸ’œπŸ«Ά

πŸ“¦ where this page comes from