lkml.org 
[lkml]   [2005]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH] arp_queue: serializing unlink + kfree_skb
From
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);
}
\
 
 \ /
  Last update: 2005-03-22 14:10    [W:0.083 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site