| To: | davem@xxxxxxxxxxxxx (David S. Miller) |
|---|---|
| Subject: | Re: [6/6]: jenkins hash for neigh |
| From: | Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> |
| Date: | Mon, 27 Sep 2004 21:48:33 +1000 |
| Cc: | laforge@xxxxxxxxxxxx, netdev@xxxxxxxxxxx |
| In-reply-to: | <20040925005623.2faf8faf.davem@davemloft.net> |
| Organization: | Core |
| Sender: | netdev-bounce@xxxxxxxxxxx |
| User-agent: | tin/1.7.4-20040225 ("Benbecula") (UNIX) (Linux/2.4.27-hx-1-686-smp (i686)) |
David S. Miller <davem@xxxxxxxxxxxxx> wrote:
>
> 3) Fix locking and GFP_* bugs.
>
> @@ -400,8 +400,11 @@
> goto out;
> }
>
> - 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 :)
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
|
| Previous by Date: | Re: [6/6]: jenkins hash for neigh, Herbert Xu |
|---|---|
| Next by Date: | Re: [IPv4]: More fib_alias insertion fixes, Robert Olsson |
| Previous by Thread: | Re: [6/6]: jenkins hash for neigh, David S. Miller |
| Next by Thread: | Re: [6/6]: jenkins hash for neigh, David S. Miller |
| Indexes: | [Date] [Thread] [Top] [All Lists] |