[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f7480e4a-26f5-b3fa-69b9-3a80e4cc362d@intel.com>
Date: Wed, 2 Dec 2020 08:55:56 +0100
From: Björn Töpel <bjorn.topel@...el.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>,
Björn Töpel <bjorn.topel@...il.com>,
ast@...nel.org, daniel@...earbox.net, netdev@...r.kernel.org,
bpf@...r.kernel.org
Cc: kafai@...com, songliubraving@...com, yhs@...com, andrii@...nel.org,
john.fastabend@...il.com, hawk@...nel.org, kuba@...nel.org,
magnus.karlsson@...el.com, maciej.fijalkowski@...el.com
Subject: Re: [PATCH bpf-next] bpf, xdp: add bpf_redirect{,_map}() leaf node
detection and optimization
On 2020-12-01 22:42, Toke Høiland-Jørgensen wrote:
> Björn Töpel <bjorn.topel@...il.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
Powered by blists - more mailing lists