rht_for_each_entry_rcu(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– rht_for_each_entry_rcu β€” the Kernel API Manual, but make it group chat πŸ’–

okay so bestie, you're in the Kernel API Manual and today's main character is a macro. yes a macro. don't scroll away, this one lowkey slaps ✨


πŸ¦‹ NAME πŸ¦‹

rht_for_each_entry_rcu β€” iterate over rcu hash chain of given type

like, that's the whole job. that's the assignment. she iterates and she does it over an rcu hash chain, and the chain is of a given type. periodt πŸ’…


🌸 SYNOPSIS 🌸

rht_for_each_entry_rcu (tpos , pos , tbl , hash , member );

that's the spell. recite it exactly, iykyk πŸŽ€


✨ ARGUMENTS ✨

  • tpos β€” the type * to use as a loop cursor. think of her as the glow-up variable that holds whatever you're actually looking at πŸ’–
  • pos β€” the struct rhash_head to use as a loop cursor. this one's the little chain-link that keeps track of where you're standing in the list 🫢
  • tbl β€” the struct bucket_table. the whole vibe container. every bucket lives here πŸͺ£
  • hash β€” the hash value / bucket index. which bucket are we sliding into? that's her 🌈
  • member β€” name of the struct rhash_head within the hashable struct. yes you have to tell her the field name, she's not a mind reader 😭

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea, bestie πŸ“

This hash chain list-traversal primitive may safely run concurrently with the _rcu mutation primitives such as rhashtable_insert β€” as long as the traversal is guarded by rcu_read_lock.

read that again. as long as. the guard is not optional, it's the whole plot πŸ”₯ the concurrency works because you locked first, not because you got lucky. no lock = no slay, fr fr πŸ’€


🧚 SEE ALSO 🧚

Kernel file ./include/linux/rhashtable.h and honestly her whole friend group:

thirty-one entries. i counted. she's popular, what can i say πŸ’…


aaaaand that's the page πŸŽ€ this beauty lives at ./include/linux, dated October 2026, and she's filed under the Kernel API Manual β€” go forth, guard your traversal with rcu_read_lock, and iterate like the icon you are πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from