LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] include:linux:Optimizations to __skb_push
@ 2015-01-22 18:02 Mohammad Jamal
  2015-01-22 18:21 ` Tom Herbert
  2015-01-23  9:05 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Mohammad Jamal @ 2015-01-22 18:02 UTC (permalink / raw)
  To: davem, therbert, edumazet, viro, alexander.h.duyck, willemb,
	hannes, linux-kernel
  Cc: Mohammad Jamal

This patch optimizes __skb_push function

Signed-off-by: Mohammad Jamal <md.jamalmohiuddin@gmail.com>
---
 include/linux/skbuff.h |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 85ab7d7..9acffb2 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -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);
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] include:linux:Optimizations to __skb_push
  2015-01-22 18:02 [PATCH] include:linux:Optimizations to __skb_push Mohammad Jamal
@ 2015-01-22 18:21 ` Tom Herbert
  2015-01-22 18:24   ` Eric Dumazet
  2015-01-23  9:05 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Tom Herbert @ 2015-01-22 18:21 UTC (permalink / raw)
  To: Mohammad Jamal
  Cc: David Miller, Eric Dumazet, viro, Alexander Duyck,
	Willem de Bruijn, Hannes Frederic Sowa, LKML

On Thu, Jan 22, 2015 at 10:02 AM, Mohammad Jamal
<md.jamalmohiuddin@gmail.com> wrote:
> This patch optimizes __skb_push function
>
> Signed-off-by: Mohammad Jamal <md.jamalmohiuddin@gmail.com>
> ---
>  include/linux/skbuff.h |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 85ab7d7..9acffb2 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -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

>  unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] include:linux:Optimizations to __skb_push
  2015-01-22 18:21 ` Tom Herbert
@ 2015-01-22 18:24   ` Eric Dumazet
  2015-01-23  1:04     ` Jamal Mohammad
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2015-01-22 18:24 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Mohammad Jamal, David Miller, viro, Alexander Duyck,
	Willem de Bruijn, Hannes Frederic Sowa, LKML

On Thu, Jan 22, 2015 at 10:21 AM, Tom Herbert <therbert@google.com> wrote:

> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] include:linux:Optimizations to __skb_push
  2015-01-22 18:24   ` Eric Dumazet
@ 2015-01-23  1:04     ` Jamal Mohammad
  0 siblings, 0 replies; 5+ messages in thread
From: Jamal Mohammad @ 2015-01-23  1:04 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Tom Herbert, David Miller, viro, Alexander Duyck,
	Willem de Bruijn, Hannes Frederic Sowa, LKML

On Thu, Jan 22, 2015 at 11:54 PM, Eric Dumazet <edumazet@google.com> wrote:
> On Thu, Jan 22, 2015 at 10:21 AM, Tom Herbert <therbert@google.com> wrote:
>
>> 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....

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] include:linux:Optimizations to __skb_push
  2015-01-22 18:02 [PATCH] include:linux:Optimizations to __skb_push Mohammad Jamal
  2015-01-22 18:21 ` Tom Herbert
@ 2015-01-23  9:05 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-01-23  9:05 UTC (permalink / raw)
  To: md.jamalmohiuddin
  Cc: therbert, edumazet, viro, alexander.h.duyck, willemb, hannes,
	linux-kernel

From: Mohammad Jamal <md.jamalmohiuddin@gmail.com>
Date: Thu, 22 Jan 2015 23:32:40 +0530

> This patch optimizes __skb_push function
> 
> Signed-off-by: Mohammad Jamal <md.jamalmohiuddin@gmail.com>

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-23  9:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22 18:02 [PATCH] include:linux:Optimizations to __skb_push Mohammad Jamal
2015-01-22 18:21 ` Tom Herbert
2015-01-22 18:24   ` Eric Dumazet
2015-01-23  1:04     ` Jamal Mohammad
2015-01-23  9:05 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).