Re: [PATCH] shrink core hashes on small systems

From: Bryan Rittmeyer
Date: Tue Apr 06 2004 - 18:06:13 EST


On Mon, Apr 05, 2004 at 05:59:11PM -0500, Matt Mackall wrote:
> On the large end, we obviously have diminishing returns for larger
> hashes and lots of dirty cachelines for hash misses. We almost
> certainly want sublinear growth here, but sqrt might be too
> aggressive.

Hand wavy.

Memory size is not necessarily predictive of optimal hash size;
certain embedded workloads may want huge TCP hashes but
render farms may only need a few dozen dentries. Why not
just start small and rehash when chains get too long (or too short)?
That gives better cache behavior _and_ memory usage at the
expensive of increased latency during rehash. Maybe that's OK?

> For 2.7, I've been thinking about pulling out a generic lookup API,
> which would allow replacing hashing with something like rbtree, etc.,
> depending on space and performance criterion.

rbtrees have different performance characteristics than a hash, and
hashing seems pretty optimal in the places it's currently used.
But, I'd love to be wrong if it means a faster kernel.

-Bryan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/