]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
bpf: runqslower: Use task local storage
authorSong Liu <songliubraving@fb.com>
Thu, 25 Feb 2021 23:43:19 +0000 (15:43 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Feb 2021 19:51:48 +0000 (11:51 -0800)
commitced47e30ab8b3ed986e28411f63e041b51c1fdf8
treef432e5e8e45d7f1b11feca958eec1ef084c9497c
parent4b0d2d4156cfb9f27d8e52a33d3522a78002fca1
bpf: runqslower: Use task local storage

Replace hashtab with task local storage in runqslower. This improves the
performance of these BPF programs. The following table summarizes average
runtime of these programs, in nanoseconds:

                          task-local   hash-prealloc   hash-no-prealloc
handle__sched_wakeup             125             340               3124
handle__sched_wakeup_new        2812            1510               2998
handle__sched_switch             151             208                991

Note that, task local storage gives better performance than hashtab for
handle__sched_wakeup and handle__sched_switch. On the other hand, for
handle__sched_wakeup_new, task local storage is slower than hashtab with
prealloc. This is because handle__sched_wakeup_new accesses the data for
the first time, so it has to allocate the data for task local storage.
Once the initial allocation is done, subsequent accesses, as those in
handle__sched_wakeup, are much faster with task local storage. If we
disable hashtab prealloc, task local storage is much faster for all 3
functions.

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210225234319.336131-7-songliubraving@fb.com
tools/bpf/runqslower/runqslower.bpf.c