netdev
[Top] [All Lists]

Re: [PATCH] improvement on net/sched/cls_fw.c's hash function

To: "David S. Miller" <davem@xxxxxxxxxxxxx>
Subject: Re: [PATCH] improvement on net/sched/cls_fw.c's hash function
From: Thomas Graf <tgraf@xxxxxxx>
Date: Wed, 6 Apr 2005 20:31:34 +0200
Cc: hadi@xxxxxxxxxx, lark@xxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20050406111509.0462abcf.davem@xxxxxxxxxxxxx>
References: <20050405213023.0256.LARK@xxxxxxxxxxxx> <1112717495.1076.22.camel@xxxxxxxxxxxxxxxx> <20050406143842.026B.LARK@xxxxxxxxxxxx> <20050406123036.GO26731@xxxxxxxxxxxxxx> <1112794459.1096.61.camel@xxxxxxxxxxxxxxxx> <20050406134502.GP26731@xxxxxxxxxxxxxx> <20050406141020.GQ26731@xxxxxxxxxxxxxx> <20050406111509.0462abcf.davem@xxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
* David S. Miller <20050406111509.0462abcf.davem@xxxxxxxxxxxxx> 2005-04-06 11:15
> On Wed, 6 Apr 2005 16:10:20 +0200
> Thomas Graf <tgraf@xxxxxxx> wrote:
> 
> > The thing I'm worrying about is that I don't want to break the perfect
> > alignment of fw_head to good slab obj sizes but I guess there is no
> > way around. I'd really like to make hash size and hash function
> > configureable. For example a hash size of 1024 would perform much
> > better and would still fit into a single page on most systems.
> 
> I think a hash xor'ing in the high bits into the low 8 bits, as has
> been suggested a few times already, meets your criteria and solves
> Lark's problem.

Yes, it sounds pretty good. I can't find any scenario where it
would perform unacceptable, it's not perfect but fair enough
for everyone I guess.

> The hash table size, if still an issue, can be dynamically sized based
> upon some criteria with some reasonable default initial selection
> (such as the current 256).

I guess sometimes it would make a lot of sense to spend a few dozen
pages for the hashtable but it's not worth to play games with the
perfectly aligned fw_head just in case. PAGESIZE/address_size would
make sense though. If someone needs something bigger it can be changed
in the source.

<Prev in Thread] Current Thread [Next in Thread>