diff --git a/source/tools/monitor/sched/schedmoni/bpf/schedmoni.bpf.c b/source/tools/monitor/sched/schedmoni/bpf/schedmoni.bpf.c index 6d56d4e0a3ab5af8c3cdcacd4a6b0c66811be3d9..8ae5bb09efc5853b1ea9a6e794954da3d68604c2 100644 --- a/source/tools/monitor/sched/schedmoni/bpf/schedmoni.bpf.c +++ b/source/tools/monitor/sched/schedmoni/bpf/schedmoni.bpf.c @@ -6,6 +6,7 @@ #include "../schedmoni.h" #include "../nosched.comm.h" +#define MAX_THRESH (10*1000) #define TASK_RUNNING 0 #define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;}) @@ -214,11 +215,19 @@ int handle_switch(struct trace_event_raw_sched_switch *ctx) return 0; } +static inline u64 adjust_thresh(u64 min_us) +{ + if (min_us > MAX_THRESH) + min_us = MAX_THRESH; + + return min_us; +} + SEC("kprobe/account_process_tick") int BPF_KPROBE(account_process_tick, struct task_struct *p, int user_tick) { int args_key; - u64 cpuid; + u64 cpuid, min_us; u64 resched_latency, now; struct latinfo lati, *latp; struct args args, *argsp; @@ -243,7 +252,8 @@ int BPF_KPROBE(account_process_tick, struct task_struct *p, int user_tick) } else { latp->ticks_without_resched++; resched_latency = (now - latp->last_seen_need_resched_ns)/1000; - if (resched_latency > _(argsp->min_us)) { + min_us = adjust_thresh(_(argsp->min_us)); + if (resched_latency > min_us) { struct key_t key; struct ext_key ext_key; struct ext_val ext_val; diff --git a/source/tools/monitor/sched/schedmoni/schedmoni.c b/source/tools/monitor/sched/schedmoni/schedmoni.c index d858fc90ee64ae0800bbb6d6fde0cafba6c2f3ea..c4b19f06755e77735cf6760a884beea933a8f9b0 100644 --- a/source/tools/monitor/sched/schedmoni/schedmoni.c +++ b/source/tools/monitor/sched/schedmoni/schedmoni.c @@ -24,7 +24,7 @@ char filename[256] = {0}; struct env env = { .span = 0, - .min_us = 10000, + .min_us = 20000, .fp = NULL, };