extern unsigned int sysctl_sched_use_walt_task_util;
extern unsigned int walt_ravg_window;
extern bool walt_disabled;
+
+#define walt_util(util_var, demand_sum) {\
+ u64 sum = demand_sum << SCHED_CAPACITY_SHIFT;\
+ do_div(sum, walt_ravg_window);\
+ util_var = (typeof(util_var))sum;\
+ }
#endif
/*
__entry->util_avg_pelt = cfs_rq->avg.util_avg;
__entry->util_avg_walt = 0;
#ifdef CONFIG_SCHED_WALT
- __entry->util_avg_walt =
- cpu_rq(cpu)->prev_runnable_sum << SCHED_CAPACITY_SHIFT;
- do_div(__entry->util_avg_walt, walt_ravg_window);
+ walt_util(__entry->util_avg_walt, cpu_rq(cpu)->prev_runnable_sum);
if (!walt_disabled && sysctl_sched_use_walt_cpu_util)
- __entry->util_avg = __entry->util_avg_walt;
+ __entry->util_avg = __entry->util_avg_walt;
#endif
),
#ifdef CONFIG_SCHED_WALT
if (!se->my_q) {
struct task_struct *p = container_of(se, struct task_struct, se);
- __entry->util_walt = p->ravg.demand;
- do_div(__entry->util_walt, walt_ravg_window >> SCHED_CAPACITY_SHIFT);
+ walt_util(__entry->util_walt, p->ravg.demand);
if (!walt_disabled && sysctl_sched_use_walt_task_util)
__entry->util = __entry->util_walt;
}
__entry->samples = samples;
__entry->evt = evt;
__entry->demand = p->ravg.demand;
- __entry->walt_avg = (__entry->demand << 10) / walt_ravg_window,
+ walt_util(__entry->walt_avg,__entry->demand);
__entry->pelt_avg = p->se.avg.util_avg;
memcpy(__entry->hist, p->ravg.sum_history,
RAVG_HIST_SIZE_MAX * sizeof(u32));
extern unsigned int walt_ravg_window;
extern bool walt_disabled;
+#ifdef CONFIG_SCHED_WALT
+#define walt_util(util_var, demand_sum) {\
+ u64 sum = demand_sum << SCHED_CAPACITY_SHIFT;\
+ do_div(sum, walt_ravg_window);\
+ util_var = (typeof(util_var))sum;\
+ }
+#endif
/*
* cpu_util returns the amount of capacity of a CPU that is used by CFS
* tasks. The unit of the return value must be the one of capacity so we can
#ifdef CONFIG_SCHED_WALT
if (!walt_disabled && sysctl_sched_use_walt_cpu_util) {
- util = cpu_rq(cpu)->cumulative_runnable_avg << SCHED_CAPACITY_SHIFT;
- util = div_u64(util, walt_ravg_window);
+ walt_util(util, cpu_rq(cpu)->cumulative_runnable_avg);
}
#endif
delta += util;
#ifdef CONFIG_SCHED_WALT
if (!walt_disabled && sysctl_sched_use_walt_cpu_util) {
- util = cpu_rq(cpu)->prev_runnable_sum << SCHED_CAPACITY_SHIFT;
- do_div(util, walt_ravg_window);
+ walt_util(util, cpu_rq(cpu)->prev_runnable_sum);
}
#endif
return (util >= capacity) ? capacity : util;