BPF List
 help / color / mirror / Atom feed
* Percpu variables, benchmarking, and performance weirdness
@ 2019-12-20  8:25 Björn Töpel
  2019-12-20  9:34 ` Jesper Dangaard Brouer
  0 siblings, 1 reply; 7+ messages in thread
From: Björn Töpel @ 2019-12-20  8:25 UTC (permalink / raw)
  To: bpf; +Cc: Jesper Dangaard Brouer

I've been doing some benchmarking with AF_XDP, and more specific the
bpf_xdp_redirect_map() helper and xdp_do_redirect(). One thing that
puzzles me is that the percpu-variable accesses stands out.

I did a horrible hack that just accesses a regular global variable,
instead of the percpu struct bpf_redirect_info, and got a performance
boost from 22.7 Mpps to 23.8 Mpps with the rxdrop scenario from
xdpsock.

Have anyone else seen this? So, my question to the uarch/percpu folks
out there: Why are percpu accesses (%gs segment register) more
expensive than regular global variables in this scenario.

One way around that is changing BPF_PROG_RUN, and BPF_CALL_x to pass a
context (struct bpf_redirect_info) explicitly, and access that instead
of doing percpu access. That would be a pretty churny patch, and
before doing that it would be nice to understand why percpu stands out
performance-wise.


Cheers,
Björn

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-20 17:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-20  8:25 Percpu variables, benchmarking, and performance weirdness Björn Töpel
2019-12-20  9:34 ` Jesper Dangaard Brouer
2019-12-20 15:12   ` Tejun Heo
2019-12-20 15:36     ` Christopher Lameter
2019-12-20 17:10       ` Dennis Zhou
2019-12-20 16:22     ` Eric Dumazet
2019-12-20 16:34       ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox