hash_for_each_rcu(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 the hlist_node within 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:

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