list_empty_careful(9)
π list_empty_careful(9) β Kernel API Manual π
okay so bestie, this is the manual page for list_empty_careful(9) from the Kernel API Manual, and it's literally the βis this list empty and also not being touched by another CPU right nowβ vibe check. No cap.
β¨ NAME β¨
list_empty_careful β tests whether a list is empty and not being modified
π SYNOPSIS π
int list_empty_careful (const struct list_head *head );
πΈ ARGUMENTS πΈ
headβ the list to test. That's it, that's the whole argument bestie π«Ά
π¦ DESCRIPTION π¦
okay so here's the tea: list_empty_careful tests whether a list is empty and checks that no other CPU might be in the process of modifying either member (next or prev). The and is doing main character energy here β do not skip it, iykyk. β¨
π₯ NOTE π₯
bestie, read this one twice. Usinglist_empty_carefulwithout synchronization can only be safe if the only activity that can happen to the list entry islist_del_init. Eg. it cannot be used if another CPU could re-list_add it. That's not a suggestion, that's the rule π
π SEE ALSO π
The kernel file is ./tools/include/linux/list.h, and the whole linked-list friend group is here:
list_add(9)list_add_tail(9)list_replace(9)list_del_init(9)list_move(9)list_move_tail(9)list_is_first(9)list_is_last(9)list_empty(9)list_rotate_left(9)list_is_singular(9)list_cut_position(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_last_entry_or_null(9)list_next_entry(9)list_prev_entry(9)list_for_each(9)list_for_each_prev(9)list_for_each_safe(9)list_for_each_prev_safe(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_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_for_each_entry(9)hlist_for_each_entry_continue(9)hlist_for_each_entry_from(9)hlist_for_each_entry_safe(9)list_del_range(9)list_for_each_from(9)
That's the whole page, bestie: source/version ./tools/include/linux, date October 2026, page list_empty_careful(9). Slay and stay synchronized πβ¨
π¦ 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