diff options
| author | Yafang Shao <laoar.shao@gmail.com> | 2025-10-16 14:39:28 +0800 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2025-10-18 19:23:08 -0700 |
| commit | ec8e3e27a140703d505c3f4fb5af0c0f12e34447 (patch) | |
| tree | 5da49b1e396e2090000c314717c69a39fdaa7e1d /tools/perf/scripts/python | |
| parent | c67f4ae73798b6f9f41921b2dc81c0055f470e41 (diff) | |
| download | linux-ec8e3e27a140703d505c3f4fb5af0c0f12e34447.tar.gz linux-ec8e3e27a140703d505c3f4fb5af0c0f12e34447.zip | |
bpf: mark mm->owner as __safe_rcu_or_null
When CONFIG_MEMCG is enabled, we can access mm->owner under RCU. The
owner can be NULL. With this change, BPF helpers can safely access
mm->owner to retrieve the associated task from the mm. We can then make
policy decision based on the task attribute.
The typical use case is as follows,
bpf_rcu_read_lock(); // rcu lock must be held for rcu trusted field
@owner = @mm->owner; // mm_struct::owner is rcu trusted or null
if (!@owner)
goto out;
/* Do something based on the task attribute */
out:
bpf_rcu_read_unlock();
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Acked-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Link: https://lore.kernel.org/r/20251016063929.13830-2-laoar.shao@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
