STRUCT RHASHTABLE(9)
π struct rhashtable(9) π
okay bestie, welcome to the Kernel API Manual β today's main character is struct rhashtable, aka the hash table handle, and honestly? she's iconic. let's get into it π«Ά
β¨ NAME β¨
struct rhashtable β Hash table handle π
πΈ SYNOPSIS πΈ
struct rhashtable {
struct bucket_table *tbl;
unsigned int key_len;
unsigned int max_elems;
struct rhashtable_params p;
bool rhlist;
struct work_struct run_work;
struct irq_work run_irq_work;
struct mutex mutex;
spinlock_t lock;
atomic_t nelems;
#ifdef CONFIG_MEM_ALLOC_PROFILING;
struct alloc_tag *alloc_tag;
#endif;
};
no cap, that's the whole vibe right there β¬οΈ
π Members π
every field gets her moment, periodt:
tblβ Bucket table πͺ£ (yes literally, that's the table of buckets, she's the whole point)key_lenβ Key length for hashfn π (how long your keys are, for the hash function's purposes)max_elemsβ Maximum number of elements in table π (the ceiling, the limit, the "we're full bestie" number)pβ Configuration parameters βοΈ (all the setup details live here)rhlistβ True if this is an rhltable π (like,booltrue. it's an rhltable. that's the whole note)run_workβ Deferred worker to expand/shrink asynchronously π§ (does the growing and shrinking later, in the background, no blocking)run_irq_workβ Bounces therun_workkick through hard IRQ context. β‘ (it relays the kick over torun_workby way of hard IRQ context, iykyk)mutexβ Mutex to protect current/future table swapping π (guard duty for the table swapping, now and later)lockβ Spin lock to protect walker list π (keeps the walker list safe)nelemsβ Number of elements in table π’ (how many are actually in there rn)
not me getting emotional over a struct with this many locks in it π she's doing the most and we love her for it
π¦ SEE ALSO π¦
- Kernel file
./include/linux/rhashtable-types.h struct rhashtable_compare_arg(9)struct rhashtable_params(9)struct rhltable(9)struct rhashtable_walker(9)struct rhashtable_iter(9)
go read the whole friend group, they're all slay π
and that's the tea, bestie π this was brought to you from ./include/linux, October 2026 edition β mwah, ily, go touch some kernel code β¨π
π¦ 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