From: Kent Overstreet <kent.overstreet@linux.dev>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David Laight <David.Laight@aculab.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Thomas Graf <tgraf@suug.ch>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"maple-tree@lists.infradead.org"
<maple-tree@lists.infradead.org>,
"rcu@vger.kernel.org" <rcu@vger.kernel.org>
Subject: Re: [PATCH 0/1] Rosebush, a new hash table
Date: Sat, 24 Feb 2024 22:20:48 -0500 [thread overview]
Message-ID: <bm5xgk5vr5g7m35x4pzbxencbv57fjceowrchrxkuy4q5ri3sb@k4lj34hpvstb> (raw)
In-Reply-To: <ZdqO3G6Fb4wYhVEj@gondor.apana.org.au>
On Sun, Feb 25, 2024 at 08:50:36AM +0800, Herbert Xu wrote:
> On Sat, Feb 24, 2024 at 10:10:27PM +0000, David Laight wrote:
> >
> > > Normally an rhashtable gets resized when it reaches 75% capacity
> > > so the average chain length should always be one.
> >
> > The average length of non-empty hash chains is more interesting.
> > You don't usually search for items in empty chains.
> > The only way you'll get all the chains of length one is if you've
> > carefully picked the data so that it hashed that way.
>
> Sure. But given the 75% capacity, you'd need a really bad hash
> function to get an *average* (not worst-case) chain length of
> 10.
>
> > I remember playing around with the elf symbol table for a browser
> > and all its shared libraries.
> > While the hash function is pretty trivial, it really didn't matter
> > whether you divided 2^n, 2^n-1 or 'the prime below 2^n' some hash
> > chains were always long.
>
> Even in the unlikely event of bad luck and everything bunches up
> together, we change theh hash function (through hash_rnd) every
> time we resize so you would expect things to even out after the
> resize event.
>
> A rehash is also automatically triggered if the worst-case chain
> length exceeds 16.
16!? that's crap, use a decent hash function and 3-5 should be your
worst upper bound.
next prev parent reply other threads:[~2024-02-25 3:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-22 20:37 [PATCH 0/1] Rosebush, a new hash table Matthew Wilcox (Oracle)
2024-02-22 20:37 ` [PATCH 1/1] rosebush: Add new data structure Matthew Wilcox (Oracle)
2024-02-25 6:38 ` Al Viro
2024-02-23 11:37 ` [PATCH 0/1] Rosebush, a new hash table Peng Zhang
2024-02-23 13:55 ` Jason A. Donenfeld
2024-02-23 18:40 ` Kent Overstreet
2024-02-24 0:20 ` Herbert Xu
2024-02-24 22:10 ` David Laight
2024-02-25 0:50 ` Herbert Xu
2024-02-25 3:20 ` Kent Overstreet [this message]
2024-02-25 3:18 ` Kent Overstreet
2024-02-25 5:01 ` Matthew Wilcox
2024-02-25 5:32 ` Herbert Xu
2024-02-25 5:51 ` Kent Overstreet
2024-02-25 5:53 ` Herbert Xu
2024-02-25 6:14 ` Kent Overstreet
2024-02-25 6:17 ` Herbert Xu
2024-02-25 14:47 ` David Laight
2024-02-25 21:48 ` Kent Overstreet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bm5xgk5vr5g7m35x4pzbxencbv57fjceowrchrxkuy4q5ri3sb@k4lj34hpvstb \
--to=kent.overstreet@linux.dev \
--cc=David.Laight@aculab.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maple-tree@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=rcu@vger.kernel.org \
--cc=tgraf@suug.ch \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).