| To: | Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> |
|---|---|
| Subject: | Re: [6/6]: jenkins hash for neigh |
| From: | "David S. Miller" <davem@xxxxxxxxxxxxx> |
| Date: | Sun, 3 Oct 2004 14:55:52 -0700 |
| Cc: | laforge@xxxxxxxxxxxx, netdev@xxxxxxxxxxx |
| In-reply-to: | <20041002075051.GA18037@xxxxxxxxxxxxxxxxxxx> |
| References: | <20040925005623.2faf8faf.davem@xxxxxxxxxxxxx> <E1CBtzd-0000zI-00@xxxxxxxxxxxxxxxxxxxxxxxx> <20040927111520.4f495b17.davem@xxxxxxxxxxxxx> <20041002075051.GA18037@xxxxxxxxxxxxxxxxxxx> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
On Sat, 2 Oct 2004 17:50:51 +1000
Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:
> On Mon, Sep 27, 2004 at 11:15:20AM -0700, David S. Miller wrote:
> > 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.
>
> Actually, why don't we just move the expansion into the locked section?
>
> Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Works for me, patch applied.
Thanks Herbert.
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH] (2/3) tcp diag info for 2.4, David S. Miller |
|---|---|
| Next by Date: | Re: [PATCH 2.6] [IPV6] SIT: dst leakage in error path., David S. Miller |
| Previous by Thread: | Re: [6/6]: jenkins hash for neigh, Herbert Xu |
| Next by Thread: | [PATCH 2.6] [IPV6] SIT: dst leakage in error path., YOSHIFUJI Hideaki / 吉藤英明 |
| Indexes: | [Date] [Thread] [Top] [All Lists] |