netdev
[Top] [All Lists]

Re: [6/6]: jenkins hash for neigh

To: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [6/6]: jenkins hash for neigh
From: "David S. Miller" <davem@xxxxxxxxxxxxx>
Date: Mon, 27 Sep 2004 11:15:20 -0700
Cc: laforge@xxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <E1CBtzd-0000zI-00@xxxxxxxxxxxxxxxxxxxxxxxx>
References: <20040925005623.2faf8faf.davem@xxxxxxxxxxxxx> <E1CBtzd-0000zI-00@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
On Mon, 27 Sep 2004 21:48:33 +1000
Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:

> > -   if (tbl->entries > (tbl->hash_mask + 1))
> > +   if (tbl->entries > (tbl->hash_mask + 1)) {
> > +           write_lock_bh(&tbl->lock);
> >             neigh_hash_grow(tbl, (tbl->hash_mask + 1) << 1);
> > +           write_unlock_bh(&tbl->lock);
> > +   }
> 
> The locking should be outside the if block as otherwise you may grow
> unnecessarily or grow into the same size :)

I'm not going to do that, because then we're grabbing that lock
twice on every neigh create operation and I was trying hard
to avoid that overhead.

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