mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Justin Iurman <justin.iurman@uliege.be>
Cc: <netdev@vger.kernel.org>, <davem@davemloft.net>,
	<dsahern@kernel.org>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <horms@kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 1/3] net: ipv6: ioam6_iptunnel: mitigate 2-realloc issue
Date: Fri, 25 Oct 2024 17:12:27 +0200	[thread overview]
Message-ID: <59a875a9-2072-467d-8989-f01525ecd08c@intel.com> (raw)
In-Reply-To: <20241025133727.27742-2-justin.iurman@uliege.be>

From: Justin Iurman <justin.iurman@uliege.be>
Date: Fri, 25 Oct 2024 15:37:25 +0200

> This patch mitigates the two-reallocations issue with ioam6_iptunnel by
> providing the dst_entry (in the cache) to the first call to
> skb_cow_head(). As a result, the very first iteration would still
> trigger two reallocations (i.e., empty cache), while next iterations
> would only trigger a single reallocation.

[...]

>  static int ioam6_do_inline(struct net *net, struct sk_buff *skb,
> -			   struct ioam6_lwt_encap *tuninfo)
> +			   struct ioam6_lwt_encap *tuninfo,
> +			   struct dst_entry *dst)
>  {
>  	struct ipv6hdr *oldhdr, *hdr;
>  	int hdrlen, err;
>  
>  	hdrlen = (tuninfo->eh.hdrlen + 1) << 3;
>  
> -	err = skb_cow_head(skb, hdrlen + skb->mac_len);
> +	err = skb_cow_head(skb, hdrlen + (!dst ? skb->mac_len
> +					       : LL_RESERVED_SPACE(dst->dev)));

You use this pattern a lot throughout the series. I believe you should
make a static inline or a macro from it.

static inline u32 some_name(const *dst, const *skb)
{
	return dst ? LL_RESERVED_SPACE(dst->dev) : skb->mac_len;
}

BTW why do you check for `!dst`, not `dst`? Does changing this affects
performance?


>  	if (unlikely(err))
>  		return err;

Thanks,
Olek

  reply	other threads:[~2024-10-25 15:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-25 13:37 [PATCH net-next 0/3] Mitigate the two-reallocations issue for iptunnels Justin Iurman
2024-10-25 13:37 ` [PATCH net-next 1/3] net: ipv6: ioam6_iptunnel: mitigate 2-realloc issue Justin Iurman
2024-10-25 15:12   ` Alexander Lobakin [this message]
2024-10-25 21:06     ` Justin Iurman
2024-10-29 15:08       ` Alexander Lobakin
2024-10-25 13:37 ` [PATCH net-next 2/3] net: ipv6: seg6_iptunnel: " Justin Iurman
2024-10-26  8:38   ` kernel test robot
2024-10-26 10:00   ` kernel test robot
2024-10-25 13:37 ` [PATCH net-next 3/3] net: ipv6: rpl_iptunnel: " Justin Iurman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59a875a9-2072-467d-8989-f01525ecd08c@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=justin.iurman@uliege.be \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®