list_next_or_null_rcu(9)
β¨ list_next_or_null_rcu(9) β¨
okay so this is a page straight out of the Kernel API Manual (yes, the kernel has a manual, and yes it's lowkey iconic) β it's all about list_next_or_null_rcu, bestie. let's get into it π
πΈ NAME πΈ
list_next_or_null_rcu β grab the next element from a list, and be super chill about it π
π¦ SYNOPSIS π¦
list_next_or_null_rcu (head , ptr , type , member );
like literally that's the whole call. four args, no drama β¨
π ARGUMENTS π
headβ the head for the list. the actual list head, the main character of the whole operation πptrβ the list head you're taking the next element from. so we start here and look forward, iykyktypeβ the type of the struct this is embedded in. tell the compiler what kinda struct we're living in fr frmemberβ the name of thelist_headwithin the struct. the lil field name that makes the magic work πͺ
π DESCRIPTION π
okay so here's the vibe check: note that if ptr is at the end of the list, NULL is returned. so no, you're not getting garbage back, you're getting a polite little NULL. we love a safe return π«Ά
and the actually important part β this primitive may safely run concurrently with the _rcu list-mutation primitives such as list_add_rcu, as long as it's guarded by rcu_read_lock. that's the whole deal, no cap. concurrent reads, rcU squad, everyone stays happy π
β οΈ bestie please don't forget the rcu_read_lock guard. that's the entire safety story, and skipping it is not the vibe π
π₯ SEE ALSO π₯
this page has SO many friends, it's giving group chat energy. all of these live 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)hlist_del_init_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_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)
aaaand that's the page! π this lil gem calls ./include/linux home, dated October 2026 β bestie that's a whole future date, main character energy fr. stay safe out there with your RCU lists, slay, periodt ππ
π¦ 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