OSDN Git Service

Merge branch 'bpf: enable task local storage for tracing'
authorAlexei Starovoitov <ast@kernel.org>
Fri, 26 Feb 2021 19:51:48 +0000 (11:51 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Feb 2021 19:51:55 +0000 (11:51 -0800)
commita7d24d9582f8cc24fabd11c458950ac94710566a
treef432e5e8e45d7f1b11feca958eec1ef084c9497c
parent9c8f21e6f8856a96634e542a58ef3abf27486801
parentced47e30ab8b3ed986e28411f63e041b51c1fdf8
Merge branch 'bpf: enable task local storage for tracing'

Song Liu says:

====================

This set enables task local storage for non-BPF_LSM programs.

It is common for tracing BPF program to access per-task data. Currently,
these data are stored in hash tables with pid as the key. In
bcc/libbpftools [1], 9 out of 23 tools use such hash tables. However,
hash table is not ideal for many use case. Task local storage provides
better usability and performance for BPF programs. Please refer to 6/6 for
some performance comparison of task local storage vs. hash table.

Changes v5 => v6:
1. Add inc/dec bpf_task_storage_busy in bpf_local_storage_map_free().

Changes v4 => v5:
1. Fix build w/o CONFIG_NET. (kernel test robot)
2. Remove unnecessary check for !task_storage_ptr(). (Martin)
3. Small changes in commit logs.

Changes v3 => v4:
1. Prevent deadlock from recursive calls of bpf_task_storage_[get|delete].
   (2/6 checks potential deadlock and fails over, 4/6 adds a selftest).

Changes v2 => v3:
1. Make the selftest more robust. (Andrii)
2. Small changes with runqslower. (Andrii)
3. Shortern CC list to make it easy for vger.

Changes v1 => v2:
1. Do not allocate task local storage when the task is being freed.
2. Revise the selftest and added a new test for a task being freed.
3. Minor changes in runqslower.
====================

Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>