STRUCT RHASHTABLE_PARAMS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct rhashtable_params(9) πŸ’–

okay so bestie, welcome to struct rhashtable_params(9), fresh out of the Kernel API Manual ✨ this is the little config struct you hand over when you're building a hash table, and honestly it's giving "main character energy" for the whole rhashtable situation πŸŽ€


🌸 NAME 🌸

struct rhashtable_params β€” Hash table construction parameters πŸ’…


✨ SYNOPSIS ✨

struct rhashtable_params {
    u16 nelem_hint;
    u16 key_len;
    u16 key_offset;
    u16 head_offset;
    unsigned int            max_size;
    u16 min_size;
    bool insecure_elasticity;
    bool automatic_shrinking;
    rht_hashfn_t hashfn;
    rht_obj_hashfn_t obj_hashfn;
    rht_obj_cmpfn_t obj_cmpfn;
 };

like, that's the whole vibe right there 🫢


🧩 Members 🧩

okay now the part you actually came for, member by member, no cap πŸ”₯

  • nelem_hint β€” a hint about how many elements you're expecting πŸ’­ it should be 75% of desired size, so don't just yeet the full number in there, okay? πŸ™ˆ
  • key_len β€” the length of the key πŸ“
  • key_offset β€” the offset of the key inside the struct that's gonna get hashed πŸ“
  • head_offset β€” the offset of rhash_head inside the struct that's gonna get hashed 🎯
  • max_size β€” the maximum size while expanding πŸ“ˆ
  • min_size β€” the minimum size while shrinking πŸ“‰ (yes they're a matching set, we love symmetry πŸ’œ)
  • insecure_elasticity β€” set to true to disable chain length checks ⚠️ bestie, the name is literally telling you it's insecure, so proceed with intention, fr fr 😭
  • hashfn β€” the hash function 🧚 default is jhash2 if !(key_len % 4), or jhash β€” that's the whole conditional, no notes ✨
  • obj_hashfn β€” function to hash the object πŸ“
  • obj_cmpfn β€” function to compare a key with an object πŸŽ€

πŸ” SEE ALSO πŸ”

go read these next, iykwup (you know what's up, bestie) πŸ‘‘

  • Kernel file ./include/linux/rhashtable-types.h struct rhashtable_compare_arg(9), struct rhashtable(9), struct rhltable(9), struct rhashtable_walker(9), struct rhashtable_iter(9) 🌈

πŸ’€ lowkey important reminder: insecure_elasticity disables chain length checks. that's a real security thing, not a cute vibe. don't say i didn't warn you 🫢

and that's the page, bestie!! no crumbs left 🌸 this little icon came from the kernel tree at ./include/linux, dated October 2026, and it's filed under struct rhashtable_params(9) β€” slay, go build a hash table, periodt πŸ’…πŸ‘‘

πŸ“¦ where this page comes from