rhashtable_replace_fast(9)
π rhashtable_replace_fast β the Kernel API Manual glow-up π¦
okay so bestie, welcome to the Kernel API Manual entry for rhashtable_replace_fast(9) β yes the header says it three times, we get it, the kernel is dramatic like that π
β¨ NAME β¨
rhashtable_replace_fast β swap an object out of a hash table, but like, fast π¨
π SYNOPSIS π
int rhashtable_replace_fast (struct rhashtable *ht , struct rhash_head
*obj_old , struct rhash_head *obj_new , const struct rhashtable_params
params );
like literally the whole thing in one line, she's not subtle πΈ
π«Ά ARGUMENTS π«Ά
htβ your hash table, the main character πobj_oldβ pointer to the hash head inside the object you're replacing (the one getting yeeted π)obj_newβ pointer to the hash head inside the object that's brand new (the one sliding in β¨)paramsβ the hash table parameters, aka the vibe check settings π
π DESCRIPTION π
so here's the tea, bestie: replacing an object doesn't affect the number of elements in the hash table, and it doesn't affect the bucket either. so lowkey we do not have to worry about shrinking or expanding the table here β none of that, not today π
Returns:
- zero on success β slay, it worked π
-ENOENTif the entry could not be found β it's giving "who? never heard of her" π-EINVALif the hash is not the same for the old and new objects β not matching, not it, red flag π©
ngl the -EINVAL one is the important one to remember: if the hashes don't line up, that replacement is not happening β
π SEE ALSO π
Kernel file ./include/linux/rhashtable.h, plus the whole friend group (they're all (9) entries, iykyk):
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)rht_for_each_entry_rcu(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)rhltable_walk_enter(9)rhltable_free_and_destroy(9)
fr fr go read them, they're iconic π§
and that's the whole page babes π courtesy of ./include/linux, dated October 2026, filed under rhashtable_replace_fast(9) β stream it, bookmark it, tell your kernel dev bestie πβ¨
π¦ 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