linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: Set trailer iff skb1 is the last one
@ 2020-08-27 11:29 Miaohe Lin
  2020-08-27 11:35 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Miaohe Lin @ 2020-08-27 11:29 UTC (permalink / raw)
  To: davem, kuba, pshelar, fw, martin.varghese, edumazet, dcaratti,
	steffen.klassert, pabeni, shmulik, kyk.segfault
  Cc: netdev, linux-kernel, linmiaohe

Set trailer iff skb1 is the skbuff where the tailbits space begins.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 net/core/skbuff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 0b24aed04060..18ed56316e56 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4488,8 +4488,9 @@ int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer)
 			skb1 = skb2;
 		}
 		elt++;
-		*trailer = skb1;
 		skb_p = &skb1->next;
+		if (!*skb_p)
+			*trailer = skb1;
 	}
 
 	return elt;
-- 
2.19.1


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

* Re: [PATCH] net: Set trailer iff skb1 is the last one
  2020-08-27 11:29 [PATCH] net: Set trailer iff skb1 is the last one Miaohe Lin
@ 2020-08-27 11:35 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2020-08-27 11:35 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: David Miller, Jakub Kicinski, Pravin B Shelar, Florian Westphal,
	martin.varghese, Davide Caratti, Steffen Klassert, Paolo Abeni,
	shmulik, kyk.segfault, netdev, LKML

On Thu, Aug 27, 2020 at 4:31 AM Miaohe Lin <linmiaohe@huawei.com> wrote:
>
> Set trailer iff skb1 is the skbuff where the tailbits space begins.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  net/core/skbuff.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 0b24aed04060..18ed56316e56 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -4488,8 +4488,9 @@ int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer)
>                         skb1 = skb2;
>                 }
>                 elt++;
> -               *trailer = skb1;
>                 skb_p = &skb1->next;
> +               if (!*skb_p)
> +                       *trailer = skb1;
>

Why is adding a conditional test going to help ?

cpu will have hard time predicting this one, I doubt this kind of
change is a win.

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

end of thread, other threads:[~2020-08-27 15:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 11:29 [PATCH] net: Set trailer iff skb1 is the last one Miaohe Lin
2020-08-27 11:35 ` Eric Dumazet

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