bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn.topel@intel.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>,
	"Björn Töpel" <bjorn.topel@gmail.com>,
	ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org,
	bpf@vger.kernel.org
Cc: kafai@fb.com, songliubraving@fb.com, yhs@fb.com,
	andrii@kernel.org, john.fastabend@gmail.com, hawk@kernel.org,
	kuba@kernel.org, magnus.karlsson@intel.com,
	maciej.fijalkowski@intel.com
Subject: Re: [PATCH bpf-next] bpf, xdp: add bpf_redirect{,_map}() leaf node detection and optimization
Date: Wed, 2 Dec 2020 08:55:56 +0100	[thread overview]
Message-ID: <f7480e4a-26f5-b3fa-69b9-3a80e4cc362d@intel.com> (raw)
In-Reply-To: <87y2ihyzhp.fsf@toke.dk>

On 2020-12-01 22:42, Toke Høiland-Jørgensen wrote:
> Björn Töpel <bjorn.topel@gmail.com> writes:
> 
[...]
>>
>> Performance up ~5% Mpps for the xdp_redirect_map and xdpsock samples,
>> and ~3% for bpf_redirect() programs.
> 
> Neat! Got actual numbers? :)
>

+~1 Mpps for AF_XDP, and +~3 Mpps for a naive (non-swapping) redirect.


[...]
> 
> This seems like an awful lot of copy-paste code reuse. Why not keep the
> __xdp_map_lookup_elem() (and flags handling) in bpf_xdp_redirect_map()
> and call this function after that lookup (using ri->tgt_value since
> you're passing in ri anyway)? Similarly, __bpf_tx_xdp_map() already does
> the disambiguation on map type for enqueue that you are duplicating here.
> 
> I realise there may be some performance benefit to the way this is
> structured (assuming the compiler is not smart enough to optimise the
> code into basically the same thing as this), but at the very least I'd
> like to see the benefit quantified before accepting this level of code
> duplication :)
>

Good points; I'll need to take this to the drawing board again. Please
refer to Alexei's reply.

Thanks for taking a look!


Björn


  reply	other threads:[~2020-12-02  7:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 17:23 [PATCH bpf-next] bpf, xdp: add bpf_redirect{,_map}() leaf node detection and optimization Björn Töpel
2020-12-01 21:42 ` Toke Høiland-Jørgensen
2020-12-02  7:55   ` Björn Töpel [this message]
2020-12-02  4:46 ` Alexei Starovoitov
2020-12-02  8:01   ` Björn Töpel

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=f7480e4a-26f5-b3fa-69b9-3a80e4cc362d@intel.com \
    --to=bjorn.topel@intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bjorn.topel@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kuba@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=toke@redhat.com \
    --cc=yhs@fb.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).