From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Justin Iurman <justin.iurman@uliege.be>
Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com,
kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com,
horms@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 1/3] net: ipv6: ioam6_iptunnel: mitigate 2-realloc issue
Date: Tue, 29 Oct 2024 10:58:42 +0000 [thread overview]
Message-ID: <f4668e71-796d-4fcf-994a-db032c6c43b6@linux.dev> (raw)
In-Reply-To: <20241028223611.26599-2-justin.iurman@uliege.be>
On 28/10/2024 22:36, Justin Iurman wrote:
> 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.
>
> Performance tests before/after applying this patch, which clearly shows
> the improvement:
> - inline mode:
> - before: https://ibb.co/LhQ8V63
> - after: https://ibb.co/x5YT2bS
> - encap mode:
> - before: https://ibb.co/3Cjm5m0
> - after: https://ibb.co/TwpsxTC
> - encap mode with tunsrc:
> - before: https://ibb.co/Gpy9QPg
> - after: https://ibb.co/PW1bZFT
>
> This patch also fixes an incorrect behavior: after the insertion, the
> second call to skb_cow_head() makes sure that the dev has enough
> headroom in the skb for layer 2 and stuff. In that case, the "old"
> dst_entry was used, which is now fixed. After discussing with Paolo, it
> appears that both patches can be merged into a single one -this one-
> (for the sake of readability) and target net-next.
>
> Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
> ---
> net/ipv6/ioam6_iptunnel.c | 90 +++++++++++++++++++++------------------
> 1 file changed, 49 insertions(+), 41 deletions(-)
>
> diff --git a/net/ipv6/ioam6_iptunnel.c b/net/ipv6/ioam6_iptunnel.c
> index beb6b4cfc551..07bfd557e08a 100644
> --- a/net/ipv6/ioam6_iptunnel.c
> +++ b/net/ipv6/ioam6_iptunnel.c
> @@ -254,15 +254,24 @@ static int ioam6_do_fill(struct net *net, struct sk_buff *skb)
> return 0;
> }
>
> +static inline int dev_overhead(struct dst_entry *dst, struct sk_buff *skb)
> +{
> + if (likely(dst))
> + return LL_RESERVED_SPACE(dst->dev);
> +
> + return skb->mac_len;
> +}
static inline functions in .c files are not welcome.
consider to move this helper to some header, probably dev.h or dst.h
and reuse it in other tunnels.
And please honor 24h rule before the next submission.
> 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 + dev_overhead(dst, skb));
> if (unlikely(err))
> return err;
>
[.. snip ..]
next prev parent reply other threads:[~2024-10-29 10:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 22:36 [PATCH net-next v3 0/3] Mitigate the two-reallocations issue for iptunnels Justin Iurman
2024-10-28 22:36 ` [PATCH net-next v3 1/3] net: ipv6: ioam6_iptunnel: mitigate 2-realloc issue Justin Iurman
2024-10-29 10:58 ` Vadim Fedorenko [this message]
2024-10-28 22:36 ` [PATCH net-next v3 2/3] net: ipv6: seg6_iptunnel: " Justin Iurman
2024-10-28 22:36 ` [PATCH net-next v3 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=f4668e71-796d-4fcf-994a-db032c6c43b6@linux.dev \
--to=vadim.fedorenko@linux.dev \
--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;
as well as URLs for NNTP newsgroup(s).