• S
    bpf: runqslower: Use task local storage · ced47e30
    Song Liu 提交于
    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: NSong Liu <songliubraving@fb.com>
    Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
    Acked-by: NAndrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/bpf/20210225234319.336131-7-songliubraving@fb.com
    ced47e30
runqslower.bpf.c 2.3 KB