Re: [bpf-next v2 1/2] bpf: add runtime stats, max cost

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

 





On 12/14/22 8:32 PM, xiangxia.m.yue@xxxxxxxxx wrote:
From: Tonghao Zhang <xiangxia.m.yue@xxxxxxxxx>

Now user can enable sysctl kernel.bpf_stats_enabled to fetch
run_time_ns and run_cnt. It's easy to calculate the average value.

In some case, the max cost for bpf prog invoked, are more useful:
is there a burst sysload or high cpu usage. This patch introduce
a update stats helper.

I am not 100% sure about how this single max value will be useful
in general. A particular max_run_time_ns, if much bigger than average,
could be an outlier due to preemption/softirq etc.
What you really need might be a trend over time of the run_time
to capture the burst. You could do this by taking snapshot of
run_time_ns/run_cnt periodically and plot the trend of average
run_time_ns which might correlate with other system activity.
Maybe I missed some use cases for max_run_time_ns...


$ bpftool --json --pretty p s
    ...
    "run_max_cost_ns": 313367

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@xxxxxxxxx>
Cc: Alexei Starovoitov <ast@xxxxxxxxxx>
Cc: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
Cc: Andrii Nakryiko <andrii@xxxxxxxxxx>
Cc: Martin KaFai Lau <martin.lau@xxxxxxxxx>
Cc: Song Liu <song@xxxxxxxxxx>
Cc: Yonghong Song <yhs@xxxxxx>
Cc: John Fastabend <john.fastabend@xxxxxxxxx>
Cc: KP Singh <kpsingh@xxxxxxxxxx>
Cc: Stanislav Fomichev <sdf@xxxxxxxxxx>
Cc: Hao Luo <haoluo@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Hou Tao <houtao1@xxxxxxxxxx>
---
v2: fix build warning
---
  include/linux/filter.h   | 29 ++++++++++++++++++++++-------
  include/uapi/linux/bpf.h |  1 +
  kernel/bpf/syscall.c     | 10 +++++++++-
  kernel/bpf/trampoline.c  | 10 +---------
  4 files changed, 33 insertions(+), 17 deletions(-)

[...]



[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