Re: [PATCH v3 bpf-next 5/8] bpf: use module_alloc_huge for bpf_prog_pack

From: Luis Chamberlain
Date: Fri May 20 2022 - 21:21:15 EST


On Fri, May 20, 2022 at 06:00:57PM -0700, Luis Chamberlain wrote:
> On Thu, May 19, 2022 at 08:15:45PM -0700, Song Liu wrote:
> > Use module_alloc_huge for bpf_prog_pack so that BPF programs sit on
> > PMD_SIZE pages. This benefits system performance by reducing iTLB miss
> > rate. Benchmark of a real web service workload shows this change gives
> > another ~0.2% performance boost on top of PAGE_SIZE bpf_prog_pack
> > (which improve system throughput by ~0.5%).

Also, seems like a is a missed opportunity to show iTLB misses with more
detail. If there was a selftest to stress bpf JIT you could use perf and
enable anyone to quanitfy gains. Dave hinted with some ideas with perf:

perf stat -e cpu/event=0x8,umask=0x84,name=dtlb_load_misses_walk_duration/,cpu/event=0x8,umask=0x82,name=dtlb_load_misses_walk_completed/,cpu/event=0x49,umask=0x4,name=dtlb_store_misses_walk_duration/,cpu/event=0x49,umask=0x2,name=dtlb_store_misses_walk_completed/,cpu/event=0x85,umask=0x4,name=itlb_misses_walk_duration/,cpu/event=0x85,umask=0x2,name=itlb_misses_walk_completed/ some_bpf_jit_test

Luis