[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1292509118.2883.167.camel@edumazet-laptop>
Date: Thu, 16 Dec 2010 15:18:38 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Junchang Wang <junchangwang@...il.com>
Cc: Changli Gao <xiaosuo@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Tom Herbert <therbert@...gle.com>,
Jiri Pirko <jpirko@...hat.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Xinan Tang <xinan.tang@...el.com>, netdev@...r.kernel.org
Subject: Re: [PATCH] net: increase skb->users instead of skb_clone()
Le jeudi 16 décembre 2010 à 22:05 +0800, Junchang Wang a écrit :
> On Thu, Dec 16, 2010 at 1:57 PM, Changli Gao <xiaosuo@...il.com> wrote:
> > In dev_queue_xmit_nit(), we have to clone skbs as we need to mangle skbs,
> > however, we don't need to clone skbs for all the packet_types.
> >
> > Except for the first packet_type, we increase skb->users instead of
> > skb_clone().
>
> Hi Changli,
> Take af_packet for example, I can't see benefit from this patch.
>
> > +static inline int deliver_skb(struct sk_buff *skb,
> > + struct packet_type *pt_prev,
> > + struct net_device *orig_dev)
> > +{
> > + atomic_inc(&skb->users);
> > + return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
> > +}
> The increment call will incur skb_shared() failure in packet_rcv.
> In reality, packet_rcv has to clone this packet by itself.
>
Yes, and no.
Consider the case you have one receiver.
Packet given after Changli patch wont be shared, so packet_rcv wont
clone it : Thats a win. Only one skb_clone() done instead of two.
Consider case with 2 receivers :
First time we call packet_rcv, packet is shared (because we call
deliver_skb(), so packet_rcv clones it. Normal situation, we really need
to clone it.
Second time, we give a non shared packet : Thats a win over previous
situation.
--
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