hlist_del_init_rcu(9)
π 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 β thinkhlist_add_head_rcuorhlist_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:
list_for_each_rcu(9)list_tail_rcu(9)list_add_rcu(9)list_add_tail_rcu(9)list_del_rcu(9)list_bidir_del_rcu(9)list_replace_rcu(9)list_splice_rcu(9)__list_splice_init_rcu(9)list_splice_init_rcu(9)list_splice_tail_init_rcu(9)list_entry_rcu(9)list_first_or_null_rcu(9)list_next_or_null_rcu(9)list_for_each_entry_rcu(9)list_for_each_entry_srcu(9)list_entry_lockless(9)list_for_each_entry_lockless(9)list_for_each_entry_continue_rcu(9)list_for_each_entry_from_rcu(9)hlist_del_rcu(9)hlist_replace_rcu(9)hlists_swap_heads_rcu(9)hlist_add_head_rcu(9)hlist_add_tail_rcu(9)hlist_add_before_rcu(9)hlist_add_behind_rcu(9)hlist_for_each_entry_rcu(9)hlist_for_each_entry_srcu(9)hlist_for_each_entry_rcu_notrace(9)hlist_for_each_entry_rcu_bh(9)hlist_for_each_entry_continue_rcu(9)hlist_for_each_entry_continue_rcu_bh(9)hlist_for_each_entry_from_rcu(9)
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
- 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