Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Justin Iurman <justin.iurman@uliege.be>,
	Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	yoshfuji@linux-ipv6.org, dsahern@kernel.org, tom@herbertland.com
Subject: Re: [RFC net-next] ipv6: Attempt to improve options code parsing
Date: Tue, 3 Aug 2021 18:35:57 +0200	[thread overview]
Message-ID: <aa58193c-0a8f-d11b-fb0c-bc41571e33ac@gmail.com> (raw)
In-Reply-To: <989297896.30838930.1628006793490.JavaMail.zimbra@uliege.be>



On 8/3/21 6:06 PM, Justin Iurman wrote:
>>> As per Eric's comment on a previous patchset that was adding a new HopbyHop
>>> option, i.e. why should a new option appear before or after existing ones in the
>>> list, here is an attempt to suppress such competition. It also improves the
>>> efficiency and fasten the process of matching a Hbh or Dst option, which is
>>> probably something we want regarding the list of new options that could quickly
>>> grow in the future.
>>>
>>> Basically, the two "lists" of options (Hbh and Dst) are replaced by two arrays.
>>> Each array has a size of 256 (for each code point). Each code point points to a
>>> function to process its specific option.
>>>
>>> Thoughts?
>>>
>> Hi Justin
>>
>> I think this still suffers from indirect call costs (CONFIG_RETPOLINE=y),
>> and eventually use more dcache.
> 
> Agree with both. It was the compromise for such a solution, unfortunately.
> 
>> Since we only deal with two sets/arrays, I would simply get rid of them
>> and inline the code using two switch() clauses.
> 
> Indeed, this is the more efficient. However, we still have two "issues":
>  - ip6_parse_tlv will keep growing and code could look ugly at some point

Well, in 10 years there has not been a lot of growth.

>  - there is still a "competition" between options, i.e. "I want to be at the top of the list"

Why would that be ?

A switch() is compiled with no particular order by the compiler.

Code generation depends on case density, and will use bisection-like strategy.

> 
> Anyway, your solution is better than the current one so it's probably the way to go right now.
> 

  reply	other threads:[~2021-08-03 16:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02 20:51 Justin Iurman
2021-08-03 15:03 ` Eric Dumazet
2021-08-03 16:06   ` Justin Iurman
2021-08-03 16:35     ` Eric Dumazet [this message]
2021-08-03 17:41       ` 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=aa58193c-0a8f-d11b-fb0c-bc41571e33ac@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=justin.iurman@uliege.be \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tom@herbertland.com \
    --cc=yoshfuji@linux-ipv6.org \
    --subject='Re: [RFC net-next] ipv6: Attempt to improve options code parsing' \
    /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

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