Message ID | 20210226112322.144927-1-bjorn.topel@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | Optimize bpf_redirect_map()/xdp_do_redirect() | expand |
Björn Töpel <bjorn.topel@gmail.com> writes: > Hi XDP-folks, > > This two patch series contain two optimizations for the > bpf_redirect_map() helper and the xdp_do_redirect() function. > > The bpf_redirect_map() optimization is about avoiding the map lookup > dispatching. Instead of having a switch-statement and selecting the > correct lookup function, we let bpf_redirect_map() be a map operation, > where each map has its own bpf_redirect_map() implementation. This way > the run-time lookup is avoided. > > The xdp_do_redirect() patch restructures the code, so that the map > pointer indirection can be avoided. > > Performance-wise I got 3% improvement for XSKMAP > (sample:xdpsock/rx-drop), and 4% (sample:xdp_redirect_map) on my > machine. > > More details in each commit. > > @Jesper/Toke I dropped your Acked-by: on the first patch, since there > were major restucturing. Please have another look! Thanks! Will do! Did you update the performance numbers above after that change? -Toke
On 2021-02-26 12:35, Toke Høiland-Jørgensen wrote: > Björn Töpel <bjorn.topel@gmail.com> writes: > >> Hi XDP-folks, >> >> This two patch series contain two optimizations for the >> bpf_redirect_map() helper and the xdp_do_redirect() function. >> >> The bpf_redirect_map() optimization is about avoiding the map lookup >> dispatching. Instead of having a switch-statement and selecting the >> correct lookup function, we let bpf_redirect_map() be a map operation, >> where each map has its own bpf_redirect_map() implementation. This way >> the run-time lookup is avoided. >> >> The xdp_do_redirect() patch restructures the code, so that the map >> pointer indirection can be avoided. >> >> Performance-wise I got 3% improvement for XSKMAP >> (sample:xdpsock/rx-drop), and 4% (sample:xdp_redirect_map) on my >> machine. >> >> More details in each commit. >> >> @Jesper/Toke I dropped your Acked-by: on the first patch, since there >> were major restucturing. Please have another look! Thanks! > > Will do! Did you update the performance numbers above after that change? > I did. The XSKMAP performance stayed the same (no surprise, since the code was the same). However, for the DEVMAP the v4 got rid of a call, so it *should* be a bit better, but for some reason it didn't show on my machine. Björn
Björn Töpel <bjorn.topel@intel.com> writes: > On 2021-02-26 12:35, Toke Høiland-Jørgensen wrote: >> Björn Töpel <bjorn.topel@gmail.com> writes: >> >>> Hi XDP-folks, >>> >>> This two patch series contain two optimizations for the >>> bpf_redirect_map() helper and the xdp_do_redirect() function. >>> >>> The bpf_redirect_map() optimization is about avoiding the map lookup >>> dispatching. Instead of having a switch-statement and selecting the >>> correct lookup function, we let bpf_redirect_map() be a map operation, >>> where each map has its own bpf_redirect_map() implementation. This way >>> the run-time lookup is avoided. >>> >>> The xdp_do_redirect() patch restructures the code, so that the map >>> pointer indirection can be avoided. >>> >>> Performance-wise I got 3% improvement for XSKMAP >>> (sample:xdpsock/rx-drop), and 4% (sample:xdp_redirect_map) on my >>> machine. >>> >>> More details in each commit. >>> >>> @Jesper/Toke I dropped your Acked-by: on the first patch, since there >>> were major restucturing. Please have another look! Thanks! >> >> Will do! Did you update the performance numbers above after that change? >> > > I did. The XSKMAP performance stayed the same (no surprise, since the > code was the same). However, for the DEVMAP the v4 got rid of a call, so > it *should* be a bit better, but for some reason it didn't show on my > machine. Alright, fair enough - pesky real world not lining up with expectations! Maybe Jesper has additional suggestions, but I can live with the 4% improvement ;) -Toke