[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131205165414.GB21745@order.stressinduktion.org>
Date: Thu, 5 Dec 2013 17:54:14 +0100
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Miller <davem@...emloft.net>, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] net: introduce dev_consume_skb_any()
On Thu, Dec 05, 2013 at 08:38:05AM -0800, Eric Dumazet wrote:
> On Thu, 2013-12-05 at 16:44 +0100, Hannes Frederic Sowa wrote:
>
> > It makes some sense but I did not grasp the whole ->users dependency
> > picture, yet. I guess the barrier is only needed when refcount drops
> > down to 0 and we don't necessarily need one when incrementing ->users.
>
> If you are the only user of this skb, really no smp barrier is needed at
> all.
>
> The problem comes when another cpu is working on the skb, and finally
> releases its reference on it.
>
> Before releasing its reference, it must commit all changes it might have
> done onto skb. Otherwise another cpu might read stale data.
>
> The smp_wmb() is done by the atomic_dec_and_test(), as it contains a
> full barrier.
>
> So the smp_rmb() pairs with the barrier done in atomic_dec_and_test()
Ha, it all makes sense now! Thanks, Eric!
(Sorry for the noise but I find this kind of problems very interesting)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists