hash_for_each_rcu(9)
π
hash_for_each_rcu β like, the Kernel API Manual page, bestie π
Okay so picture this: you're deep in ./include/linux/hashtable.h, the vibes are immaculate, and you need to walk a whole RCU-enabled hashtable, entry by entry. That's literally this macro. It's giving "loop over everything, safely, while the rest of the kernel is out there living its best life." β¨
πΈ NAME πΈ
hash_for_each_rcu β iterate over a rcu enabled hashtable
Yes bestie, that's the whole job. Iterate. Over a hashtable. One that has RCU enabled. No cap. π¦
β¨ SYNOPSIS β¨
hash_for_each_rcu (name , bkt , obj , member );
Look at her. Four args, one line, absolutely iconic. π
π ARGUMENTS π
nameβ the hashtable you're iterating, the main character of this whole operation. π«Άbktβ an integer you get to use as the bucket loop cursor. She's the little index that keeps track of where you are, lowkey doing so much work behind the scenes. π₯objβ the type * to use as a loop cursor for each entry β like, the pointer type that gets handed to you on every pass through the loop. βmemberβ the name of thehlist_nodewithin the struct. Like, which field inside your struct is the one that actually links it into the hashtable. That's her. That's the connector. π§
π SEE ALSO π
Kernel file ./include/linux/hashtable.h β and honestly the whole friend group lives in there:
hash_init(9)hash_add(9)hash_add_rcu(9)hash_hashed(9)hash_empty(9)hash_del(9)hash_del_rcu(9)hash_for_each(9)hash_for_each_safe(9)hash_for_each_possible(9)hash_for_each_possible_rcu(9)hash_for_each_possible_rcu_notrace(9)hash_for_each_possible_safe(9)
All of them are in the group chat, all of them slay in their own special way, and you should absolutely go say hi. π
Ngl, this macro only ever got written down in June 2026 β like, freshly documented, we love a queen who just arrived. π
And that's a wrap, bestie β page brought to you by ./include/linux, dated October 2026, in the one and only Kernel API Manual. Go forth and iterate. Mwah. π
πππΈπ¦
π¦ 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