hlist_nulls_...ace_init_rcu(9)
π 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 shockednewβ 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:
hlist_nulls_del_init_rcu(9)hlist_nulls_first_rcu(9)hlist_nulls_next_rcu(9)hlist_nulls_pprev_rcu(9)hlist_nulls_del_rcu(9)hlist_nulls_add_head_rcu(9)hlist_nulls_add_tail_rcu(9)hlist_nulls_replace_rcu(9)hlist_nulls_for_each_entry_rcu(9)hlist_nulls_for_each_entry_safe(9)
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
- 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