smp_rmb() in consume_skb

Kshemendra KP kshemendra at suphalaam.com
Thu Oct 11 08:20:40 EDT 2012


Hi,

    When I was looking into consume_skb() routine (net/core/skbuff.c),
there is smp_rmb() read barrier is present.
    It is not clear why this is needed here.  Basically this routine frees
sk_buff if only one user reference is theere

     void consume_skb(struct sk_buff * skb)
     {
         if (unlikely(!skb))
              return;
         if (likley (atomic_read (&skb->users) == 1))
              smp_rmb()
 --------------------------------------------------------> need for this
barrier

            ......
          __kfree_skb();
     }


Regards

Kshemendra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121011/2511c77c/attachment.html 


More information about the Kernelnewbies mailing list