hlist_unhashed_lockless(9)
π hlist_unhashed_lockless(9) β Kernel API Manual
okay so bestie, this is a page from the Kernel API Manual and it's about exactly one (1) little function. She's small. She's niche. She's lowkey iconic. Let's get into it π«Ά
β¨ NAME β¨
hlist_unhashed_lockless β the version of hlist_unhashed made for lockless use, no cap
So yeah, it's the same vibe check as hlist_unhashed, just built different so you can run it when there's no lock holding your hand π
πΈ SYNOPSIS πΈ
int hlist_unhashed_lockless (const struct hlist_node *h );
π¦ ARGUMENTS π¦
hβ the node you wanna check, bestie. That's it. That's the whole argument π
π DESCRIPTION π
Okay so here's the tea β β this is a variant of hlist_unhashed, and you must use this one in lockless contexts to dodge potential load-tearing. Like, not "should", not "maybe", must. This is the whole reason she exists π§
The way it works is the READ_ONCE in here is paired with the various WRITE_ONCE calls in the hlist helpers that are defined below π β so the reads and writes are matching sets, iykyk. Not me being obsessed with memory ordering at 3am ππ₯
fr fr, if you're in a lockless context and you reach for plain hlist_unhashed instead of her, that's a load-tearing situation waiting to happen. read the room π
π SEE ALSO π
Kernel file ./include/linux/list.h β and then the whole friend group, because these list helpers literally never leave each other's side π
LIST_HEAD_INIT(9)LIST_HEAD(9)LIST_HEAD_GUARDED(9)INIT_LIST_HEAD(9)list_add(9)list_add_tail(9)list_add_tail_release(9)list_del(9)list_replace(9)list_replace_init(9)list_swap(9)list_del_init(9)list_move(9)list_move_tail(9)list_bulk_move_tail(9)list_is_first(9)list_is_last(9)list_is_head(9)list_empty(9)list_del_init_careful(9)list_empty_careful(9)list_rotate_left(9)list_rotate_to_front(9)list_is_singular(9)list_cut_position(9)list_cut_before(9)list_splice(9)list_splice_tail(9)list_splice_init(9)list_splice_tail_init(9)list_entry(9)list_first_entry(9)list_last_entry(9)list_first_entry_or_null(9)list_first_entry_or_null_acquire(9)list_last_entry_or_null(9)list_next_entry(9)list_next_entry_circular(9)list_prev_entry(9)list_prev_entry_circular(9)list_for_each(9)list_for_each_continue(9)list_for_each_prev(9)list_for_each_safe(9)list_for_each_prev_safe(9)list_count_nodes(9)list_entry_is_head(9)list_for_each_entry(9)list_for_each_entry_reverse(9)list_prepare_entry(9)list_for_each_entry_continue(9)list_for_each_entry_continue_reverse(9)list_for_each_entry_from(9)list_for_each_entry_from_reverse(9)list_for_each_entry_safe(9)list_for_each_entry_safe_continue(9)list_for_each_entry_safe_from(9)list_for_each_entry_safe_reverse(9)list_safe_reset_next(9)hlist_unhashed(9)hlist_empty(9)hlist_del(9)hlist_del_init(9)hlist_add_head(9)hlist_add_before(9)hlist_add_behind(9)hlist_add_fake(9)hlist_fake(9)hlist_is_singular_node(9)hlist_move_list(9)hlist_splice_init(9)hlist_for_each_entry(9)hlist_for_each_entry_continue(9)hlist_for_each_entry_from(9)hlist_for_each_entry_safe(9)hlist_count_nodes(9)
and that's the whole page, bestie π it's giving "one function, one job, zero tearing" and honestly? we love a focused queen π
this absolute icon lives over in ./include/linux and the version we're looking at is October 2026 β so yeah, mark your calendar, screenshot the receipt, and go use the lockless version in your lockless code πβ¨
π¦ 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