Messages in this thread Patch in this message | | | Date | Fri, 4 Feb 2005 10:50:44 +1100 | Subject | Re: [PATCH] arp_queue: serializing unlink + kfree_skb | From | Herbert Xu <> |
| |
On Thu, Feb 03, 2005 at 02:19:01PM -0800, David S. Miller wrote: > > They are for cases where you want strict ordering even for the > non-return-value-giving atomic_t ops.
I see. I got atomic_dec and atomic_dec_and_test mixed up.
So the problem isn't as big as I thought which is good. sk_buff is only in trouble because of the atomic_read optimisation which really needs a memory barrier.
However, instead of adding a memory barrier which makes the optimisation less useful, let's just get rid of the atomic_read.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Thanks for the document, it's really helpful.
Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ===== include/linux/skbuff.h 1.59 vs edited ===== --- 1.59/include/linux/skbuff.h 2005-01-11 07:23:55 +11:00 +++ edited/include/linux/skbuff.h 2005-02-04 10:44:17 +11:00 @@ -353,14 +353,14 @@ */ static inline void kfree_skb(struct sk_buff *skb) { - if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users)) + if (atomic_dec_and_test(&skb->users)) __kfree_skb(skb); } /* Use this if you didn't touch the skb state [for fast switching] */ static inline void kfree_skb_fast(struct sk_buff *skb) { - if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users)) + if (atomic_dec_and_test(&skb->users)) kfree_skbmem(skb); } | |