rht_for_each_entry_rcu(9)
π 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β thestruct rhash_headto use as a loop cursor. this one's the little chain-link that keeps track of where you're standing in the list π«Άtblβ thestruct 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 thestruct rhash_headwithin 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:
struct bucket_table(9)rht_grow_above_75(9)rht_shrink_below_30(9)rht_grow_above_100(9)rht_grow_above_max(9)rht_for_each_from(9)rht_for_each(9)rht_for_each_entry_from(9)rht_for_each_entry(9)rht_for_each_entry_safe(9)rht_for_each_rcu_from(9)rht_for_each_rcu(9)rht_for_each_entry_rcu_from(9)rhl_for_each_rcu(9)rhl_for_each_entry_rcu(9)rhashtable_lookup(9)rhashtable_lookup_fast(9)rhltable_lookup(9)rhashtable_insert_fast(9)rhltable_insert_key(9)rhltable_insert(9)rhashtable_lookup_insert_fast(9)rhashtable_lookup_get_insert_fast(9)rhashtable_lookup_insert_key(9)rhashtable_lookup_get_insert_key(9)rhashtable_remove_fast(9)rhltable_remove(9)rhashtable_replace_fast(9)rhltable_walk_enter(9)rhltable_free_and_destroy(9)
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
- 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