net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()
Subsystems (2)
Quoted 7 lines · Eric Dumazet
Quoted 3 lines · Miaohe Lin
The
skb_shared_infopart of the data is assigned in the following loop. It is meaningless to do a memcpy here.Reminder : net-next is CLOSED.
Thanks for your remind. I would wait for it open.
Quoted 10 lines
This is not correct. We still have to copy _something_
Something like :
net/core/skbuff.c +0
-0@@ -5953,8 +5953,8 @@ static int pskb_carve_inside_nonlinear(struct sk_buff *skb, const u32 off, size =SKB_WITH_OVERHEAD (ksize (data));
net/core/skbuff.c static int pskb_carve_inside_nonlinear(struct sk_buff *skb, const u32 off,
Quoted 10 lines
net/core/skbuff.c +3
-2memcpy ((struct skb_shared_info *)(data + size), -skb_shinfo (skb), offsetof(struct skb_shared_info , - frags[skb_shinfo(skb)->nr_frags])); +skb_shinfo (skb), offsetof(struct skb_shared_info , + frags[0])); +if (skb_orphan_frags (skb, gfp_mask)) {kfree (data);return -ENOMEM ;
This looks good. Will send a patch v2 soon. May I add a suggested-by tag of you ? Many thanks.
Quoted 21 lines · linmiaohe
Quoted 7 lines · Eric Dumazet
Quoted 3 lines · Miaohe Lin
The
skb_shared_infopart of the data is assigned in the following loop. It is meaningless to do a memcpy here.Reminder : net-next is CLOSED.
Thanks for your remind. I would wait for it open.
Quoted 10 lines
This is not correct. We still have to copy _something_
Something like :
net/core/skbuff.c +0
-0@@ -5953,8 +5953,8 @@ static int pskb_carve_inside_nonlinear(struct sk_buff *skb, const u32 off, size =SKB_WITH_OVERHEAD (ksize (data));
Quoted 12 lines
net/core/skbuff.c static int pskb_carve_inside_nonlinear(struct sk_buff *skb, const u32 off,
Quoted 10 lines
net/core/skbuff.c +3
-2memcpy ((struct skb_shared_info *)(data + size), -skb_shinfo (skb), offsetof(struct skb_shared_info , - frags[skb_shinfo(skb)->nr_frags])); +skb_shinfo (skb), offsetof(struct skb_shared_info , + frags[0])); +if (skb_orphan_frags (skb, gfp_mask)) {kfree (data);return -ENOMEM ;This looks good. Will send a patch v2 soon. May I add a suggested-by tag of you ?
I would advise not using Suggested-by, as this would imply I suggested the idea of changing this function in the first place.
I will add a Reviewed-by: eventually if your v2 submission looks fine to me.
Thanks.
Quoted 2 lines
Many thanks.