diff options
author | Song Liu <songliubraving@fb.com> | 2021-02-12 10:31:05 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-02-12 12:56:53 -0800 |
commit | 3a7b35b899dedd29468301a3cbc4fa48a49e2131 (patch) | |
tree | d3881356d0f0c93e866b1fe062f899b6863fc370 /kernel/gcov | |
parent | a79e88dd2ca6686dca77c9c53c3e12c031347348 (diff) |
bpf: Introduce task_vma bpf_iter
Introduce task_vma bpf_iter to print memory information of a process. It
can be used to print customized information similar to /proc/<pid>/maps.
Current /proc/<pid>/maps and /proc/<pid>/smaps provide information of
vma's of a process. However, these information are not flexible enough to
cover all use cases. For example, if a vma cover mixed 2MB pages and 4kB
pages (x86_64), there is no easy way to tell which address ranges are
backed by 2MB pages. task_vma solves the problem by enabling the user to
generate customize information based on the vma (and vma->vm_mm,
vma->vm_file, etc.).
To access the vma safely in the BPF program, task_vma iterator holds
target mmap_lock while calling the BPF program. If the mmap_lock is
contended, task_vma unlocks mmap_lock between iterations to unblock the
writer(s). This lock contention avoidance mechanism is similar to the one
used in show_smaps_rollup().
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210212183107.50963-2-songliubraving@fb.com
Diffstat (limited to 'kernel/gcov')
0 files changed, 0 insertions, 0 deletions