[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANn89iJ7orDEWxdBJVYqhk+1WF2ZuRpzN_XOaPoGRrn2hWjGNQ@mail.gmail.com>
Date: Thu, 27 Aug 2020 04:37:08 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Miaohe Lin <linmiaohe@...wei.com>
Cc: David Miller <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Pravin B Shelar <pshelar@....org>,
Florian Westphal <fw@...len.de>, martin.varghese@...ia.com,
Davide Caratti <dcaratti@...hat.com>,
Steffen Klassert <steffen.klassert@...unet.com>,
Paolo Abeni <pabeni@...hat.com>, shmulik@...anetworks.com,
kyk.segfault@...il.com, netdev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: exit immediately when off = 0 in skb_headers_offset_update()
On Thu, Aug 27, 2020 at 4:25 AM Miaohe Lin <linmiaohe@...wei.com> wrote:
>
> In the case of off = 0, skb_headers_offset_update() do nothing indeed.
>
> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> ---
> net/core/skbuff.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 18ed56316e56..f67f0da20a5b 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -1459,6 +1459,8 @@ EXPORT_SYMBOL(skb_clone);
>
> void skb_headers_offset_update(struct sk_buff *skb, int off)
> {
> + if (unlikely(off == 0))
> + return;
If this is unlikely, I doubt adding a test is going to save anything.
This will instead add a conditional test for the 'likely' cases.
Powered by blists - more mailing lists