Hi,

The way I read this, __kfree_skb will sometimes be called with ->users = 1 and 
sometimes with ->users = 0, is that right?  

static inline void kfree_skb(struct sk_buff *skb)
{
        if (likely(atomic_read(&skb->users) == 1))
                smp_rmb();
        else if (likely(!atomic_dec_and_test(&skb->users)))
                return;
        __kfree_skb(skb);
}

If so, then why not just:

static inline void kfree_skb(struct sk_buff *skb)
{
        if (likely(atomic_read(&skb->users) == 1))
                smp_rmb();
        if (likely(!atomic_dec_and_test(&skb->users)))
                return;
        __kfree_skb(skb);
}

so __kfree_skb can BUG_ON(atomic_read(&skb->users))?  Perhaps this has 
something to do with the smp_rmb, could somebody please explain to me why it 
is necessary here, and for which architectures?

Anyway, do we not want BUG_ON(!atomic_read(&skb->users)) at the beginning of 
kfree_skb, since we rely on it?

Regards,

Daniel
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to