rhashtable_shrink(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 πŸ”₯

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