rhashtable_shrink(9)
π rhashtable_shrink(9) β like, the Kernel API Manual page you actually wanna read π
okay so bestie, welcome to the rhashtable_shrink page from the Kernel API Manual β section 9, kernel territory, we're in the big leagues now π§β¨ grab ur matcha, this one's short but she's important.
β¨ NAME β¨
rhashtable_shrink β shrink a hash table while still letting concurrent lookups happen, no cap π
πΈ SYNOPSIS πΈ
int rhashtable_shrink (struct rhashtable *ht );
π ARGUMENTS π
htβ the hash table u wanna shrink. that's it. that's the whole argument. iconic minimalism π
π¦ DESCRIPTION π¦
so what she does: this function shrinks the hash table to fit β meaning it makes it the smallest size that wouldn't cause it to expand right away automatically. like, she's not gonna yeet it down to a size where it immediately bounces back up, that would be embarrassing π she picks the right size. periodt.
now the rules, and bestie these are non-negotiable π:
- the caller must make sure no concurrent resizing is happening, by holding
ht->mutex. hold the mutex. hold it. π - the caller must make sure no concurrent table mutations are taking place. no sneaky edits while she's working, fr fr.
- it is however valid to have concurrent lookups, as long as they're RCU protected. reads are fine, she's chill with reads π«Ά
- it is valid to have concurrent insertions and deletions protected by per bucket locks, or concurrent RCU protected lookups and traversals. so those combos slay, ur good π
bestie pls don't skip the mutex part. that's the whole vibe check of this function. no mutex = chaos, and not the cute kind π
π₯ SEE ALSO π₯
- Kernel file
./lib/rhashtable.c rhashtable_next_key(9)rhashtable_walk_enter(9)rhashtable_walk_exit(9)rhashtable_walk_start_check(9)__rhashtable_walk_find_next(9)rhashtable_walk_next(9)rhashtable_walk_peek(9)rhashtable_walk_stop(9)rhashtable_free_and_destroy(9)
like, the whole rhashtable friend group π go read the rest of them, they're all in ./lib and they all ate π
and that's the page, bestie!! πβ¨ this lil beauty lives in ./lib, dated October 2026, and yes she's filed as rhashtable_shrink(9) β go forth and shrink responsibly, 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