hlist_del_init_rcu(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… hlist_del_init_rcu(9) β€” from the Kernel API Manual, bestie

okay so picture this: you're deep in rculist.h, the vibes are immaculate, and you need one specific node to leave the hash list β€” but you also need it to leave with its dignity intact, all re-initialized and ready for its next era. that's this function. she's a void, she takes one argument, she does not miss. ✨


🌸 NAME 🌸

hlist_del_init_rcu β€” deletes an entry from a hash list, with re-initialization. like, she doesn't just ghost the list, she re-invents herself afterward. periodt. πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

void hlist_del_init_rcu (struct hlist_node *n );

literally one line, one pointer, zero drama. she ate. πŸ¦‹


πŸ”₯ ARGUMENTS πŸ”₯

  • n β€” the element you're deleting from the hash list. that's her. that's the one. the main character of this whole operation. πŸ‘‘

πŸ’€ NOTE πŸ’€

so here's the part you actually need to remember, bestie, and i'm saying it with love:

after this runs, list_unhashed on the node returns true. ngl that little fact is the whole point, because it's useful for RCU-based read lockfree traversal β€” the writer side genuinely needs to know whether the list entry is still hashed or already unhashed. iykyk. 🫢

and in particular β€” this is the key lore β€” it means we can not poison the forward pointers, because those may still be used for walking the hash list. so the only thing we can zero is the pprev pointer, so that list_unhashed will return true after this. that's the entire trick. no cap. ✨

okay now the serious bit, and i'm gonna say it clearly because it matters: the caller must take whatever precautions are necessary (like holding appropriate locks) to avoid racing with another list-mutation primitive β€” think hlist_add_head_rcu or hlist_del_rcu β€” running on this same list. so like, protect your data. πŸ™ˆ

but β€” and this is the good news β€” it is perfectly legal to run concurrently with the _rcu list-traversal primitives, such as hlist_for_each_entry_rcu. no locks needed on the reader side, she's designed for that. slay. 🌈


⭐ SEE ALSO ⭐

all the siblings, cousins, and extended family, living in the kernel file ./include/linux/rculist.h:


and that's the whole page, bestie πŸ§šπŸ’œ β€” sourced straight from ./include/linux, dated October 2026, page hlist_del_init_rcu(9). go forth and unhash responsibly. πŸ“πŸ’…

πŸ“¦ where this page comes from