Re: Accessing mm_rss_stat fields with btf/BPF_CORE_READ_INTO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 6/20/20 9:22 AM, Matt Pallissard wrote:
New to bpf here.

I'm trying to read values out of of mm_struct.  I have code like this;

unsigned long i[10] = {};
struct task_struct *t;
struct mm_rss_stat *rss;

t = (struct task_struct *)bpf_get_current_task();
BPF_CORE_READ_INTO(&rss, t, mm, rss_stat);
BPF_CORE_READ_INTO(i, rss, count);

However, all values in `i` appear to be 0 (i[MM_FILEPAGES], etc), as if no data gets copied.  I'm about 100% confident that this is caused by a glaring oversight on my part.

Maybe you want to check the return value of BPF_CORE_READ_INTO.
Underlying it is using bpf_probe_read and bpf_probe_read may fail e.g., due to major fault.


Any advice or documentation I could sift through would be greatly appreciated.  Thanks.


Matt Pallissard




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux