include:linux:Optimizations to __skb_push
PATCH 1/1 include:linux:Optimizations to __skb_push
This patch optimizes __skb_push function
--- include/linux/skbuff.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/skbuff.h +1 -2
@@ -1671,9 +1671,8 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)unsigned char *skb_push (struct sk_buff *skb,unsigned int len);static inline unsigned char *__skb_push (struct sk_buff *skb,unsigned int len) { - skb->data -= len; skb->len += len; -return skb->data; +return skb->data -= len; }unsigned char *skb_pull (struct sk_buff *skb,unsigned int len);
Signature · 1 line
1.7.9.5
Quoted 12 lines · Mohammad Jamal
This patch optimizes
__skb_pushfunctionSigned-off-by Mohammad Jamal <[email protected]>--- include/linux/skbuff.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)include/linux/skbuff.h +0
-0
include/linux/skbuff.h static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) · line 1677
Quoted 9 lines
include/linux/skbuff.h +1
-2@@ -1671,9 +1671,8 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)unsigned char *skb_push (struct sk_buff *skb,unsigned int len);static inline unsigned char *__skb_push (struct sk_buff *skb,unsigned int len) { - skb->data -= len; skb->len += len; -return skb->data; +return skb->data -= len; }
Hmm, this seems less readable to me. What is the effect of this patch? Does the compiler even produce different assembly?
Thanks,
Tom
Quoted 4 lines
include/linux/skbuff.h +0
-1unsigned char *skb_pull (struct sk_buff *skb,unsigned int len); --1.7.9.5
Quoted 2 lines · Tom Herbert
Hmm, this seems less readable to me. What is the effect of this patch? Does the compiler even produce different assembly?
No change at all in generated assembly, this looks not worth it.
BTW, most __skb_push() callers ignore return value.
Quoted 8 lines · Eric Dumazet
Quoted 2 lines · Tom Herbert
Hmm, this seems less readable to me. What is the effect of this patch? Does the compiler even produce different assembly?
No change at all in generated assembly, this looks not worth it.
BTW, most
__skb_push()callers ignore return value.
it just reduces the number of lines....
David Miller
maintainerFrom: Mohammad Jamal <[email protected]>
Date: Thu, 22 Jan 2015 23:32:40 +0530
Quoted 3 lines
This patch optimizes
__skb_pushfunctionSigned-off-by Mohammad Jamal <[email protected]>
A patch with a commit message that doesn't even explain the optimization, or why it is worthwhile to make that optimization, will not be applied, sorry.