diff options
author | David Vernet <void@manifault.com> | 2022-11-19 23:10:03 -0600 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-11-20 09:16:21 -0800 |
commit | 90660309b0c76c564a31a21f3a81d6641a9acaa0 (patch) | |
tree | dac6bcbbda3253e99b4a41e9c5c33b62d6adae00 /net | |
parent | 3f00c52393445ed49aadc1a567aa502c6333b1a1 (diff) | |
download | linux-90660309b0c76c564a31a21f3a81d6641a9acaa0.tar.gz linux-90660309b0c76c564a31a21f3a81d6641a9acaa0.tar.bz2 linux-90660309b0c76c564a31a21f3a81d6641a9acaa0.zip |
bpf: Add kfuncs for storing struct task_struct * as a kptr
Now that BPF supports adding new kernel functions with kfuncs, and
storing kernel objects in maps with kptrs, we can add a set of kfuncs
which allow struct task_struct objects to be stored in maps as
referenced kptrs. The possible use cases for doing this are plentiful.
During tracing, for example, it would be useful to be able to collect
some tasks that performed a certain operation, and then periodically
summarize who they are, which cgroup they're in, how much CPU time
they've utilized, etc.
In order to enable this, this patch adds three new kfuncs:
struct task_struct *bpf_task_acquire(struct task_struct *p);
struct task_struct *bpf_task_kptr_get(struct task_struct **pp);
void bpf_task_release(struct task_struct *p);
A follow-on patch will add selftests validating these kfuncs.
Signed-off-by: David Vernet <void@manifault.com>
Link: https://lore.kernel.org/r/20221120051004.3605026-4-void@manifault.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions