Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00acd044 authored by Steve Muckle's avatar Steve Muckle
Browse files

sched: trace: extend sched_cpu_load to print irqload



The irqload is used in determining whether CPUs are mostly idle
so it is useful to know this value while viewing scheduler traces.

Change-Id: Icbb74fc1285be878f254ae54886bdb161b14a270
Signed-off-by: default avatarSteve Muckle <smuckle@codeaurora.org>
parent 51f0d766
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1404,7 +1404,7 @@ Logged when selecting the best CPU to run a task (select_best_cpu() for fair
class tasks, find_lowest_rq_hmp() for RT tasks) and load balancing
(update_sg_lb_stats()).

<idle>-0     [004] d.h3 12700.711541: sched_cpu_load: cpu 0 idle 1 mostly_idle 1 nr_run 0 nr_big 0 nr_small 0 lsf 1945 capacity 1045 cr_avg 0 fcur 199200 fmax 940800 power_cost 1045 cstate 1
<idle>-0     [004] d.h3 12700.711541: sched_cpu_load: cpu 0 idle 1 mostly_idle 1 nr_run 0 nr_big 0 nr_small 0 lsf 1945 capacity 1045 cr_avg 0 irqload 4456 fcur 199200 fmax 940800 power_cost 1045 cstate 1

- cpu: the CPU being described
- idle: boolean indicating whether the CPU is idle
@@ -1417,6 +1417,7 @@ class tasks, find_lowest_rq_hmp() for RT tasks) and load balancing
- capacity: capacity of CPU (based on max possible frequency and efficiency)
- cr_avg: cumulative runnable average, instantaneous sum of the demand (either
  PELT or window-based) of all the runnable task on a CPU (ns)
- irqload: decaying average of irq activity on CPU (ns)
- fcur: current CPU frequency (Khz)
- fmax: max CPU frequency (but not maximum _possible_ frequency) (KHz)
- power_cost: cost of running this CPU at the current frequency
+9 −6
Original line number Diff line number Diff line
@@ -152,10 +152,10 @@ TRACE_EVENT(sched_task_load,

TRACE_EVENT(sched_cpu_load,

	TP_PROTO(struct rq *rq, int idle, int mostly_idle,
	TP_PROTO(struct rq *rq, int idle, int mostly_idle, u64 irqload,
		 unsigned int power_cost),

	TP_ARGS(rq, idle, mostly_idle, power_cost),
	TP_ARGS(rq, idle, mostly_idle, irqload, power_cost),

	TP_STRUCT__entry(
		__field(unsigned int, cpu			)
@@ -167,6 +167,7 @@ TRACE_EVENT(sched_cpu_load,
		__field(unsigned int, load_scale_factor		)
		__field(unsigned int, capacity			)
		__field(	 u64, cumulative_runnable_avg	)
		__field(	 u64, irqload			)
		__field(unsigned int, cur_freq			)
		__field(unsigned int, max_freq			)
		__field(unsigned int, power_cost		)
@@ -183,17 +184,19 @@ TRACE_EVENT(sched_cpu_load,
		__entry->load_scale_factor	= rq->load_scale_factor;
		__entry->capacity		= rq->capacity;
		__entry->cumulative_runnable_avg = rq->cumulative_runnable_avg;
		__entry->irqload		= irqload;
		__entry->cur_freq		= rq->cur_freq;
		__entry->max_freq		= rq->max_freq;
		__entry->power_cost		= power_cost;
		__entry->cstate			= rq->cstate;
	),

	TP_printk("cpu %u idle %d mostly_idle %d nr_run %u nr_big %u nr_small %u lsf %u capacity %u cr_avg %llu fcur %u fmax %u power_cost %u cstate %d",
	TP_printk("cpu %u idle %d mostly_idle %d nr_run %u nr_big %u nr_small %u lsf %u capacity %u cr_avg %llu irqload %llu fcur %u fmax %u power_cost %u cstate %d",
	__entry->cpu, __entry->idle, __entry->mostly_idle, __entry->nr_running,
	__entry->nr_big_tasks, __entry->nr_small_tasks,
	__entry->load_scale_factor, __entry->capacity,
	__entry->cumulative_runnable_avg, __entry->cur_freq, __entry->max_freq,
	__entry->cumulative_runnable_avg, __entry->irqload,
	__entry->cur_freq, __entry->max_freq,
	__entry->power_cost, __entry->cstate)
);

+5 −2
Original line number Diff line number Diff line
@@ -1721,7 +1721,8 @@ static int best_small_task_cpu(struct task_struct *p)
	for_each_cpu(i, &search_cpus) {

		trace_sched_cpu_load(cpu_rq(i), idle_cpu(i),
				     mostly_idle_cpu(i), power_cost(p, i));
				     mostly_idle_cpu(i), sched_irqload(i),
				     power_cost(p, i));

		cpu_cost = power_cost(p, i);
		if (cpu_cost < min_cost) {
@@ -1870,7 +1871,8 @@ static int select_best_cpu(struct task_struct *p, int target, int reason)
	for_each_cpu_and(i, tsk_cpus_allowed(p), cpu_online_mask) {

		trace_sched_cpu_load(cpu_rq(i), idle_cpu(i),
				     mostly_idle_cpu(i), power_cost(p, i));
				     mostly_idle_cpu(i), sched_irqload(i),
				     power_cost(p, i));

		if (skip_cpu(p, i, reason))
			continue;
@@ -5864,6 +5866,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,

		trace_sched_cpu_load(cpu_rq(i), idle_cpu(i),
				     mostly_idle_cpu(i),
				     sched_irqload(i),
				     power_cost_at_freq(i, 0));
		nr_running = rq->nr_running;

+2 −2
Original line number Diff line number Diff line
@@ -1554,8 +1554,8 @@ static int find_lowest_rq_hmp(struct task_struct *task)
	for_each_cpu(i, lowest_mask) {
		struct rq *rq = cpu_rq(i);
		cpu_cost = power_cost_at_freq(i, ACCESS_ONCE(rq->min_freq));
		trace_sched_cpu_load(rq, idle_cpu(i),
				     mostly_idle_cpu(i), cpu_cost);
		trace_sched_cpu_load(rq, idle_cpu(i), mostly_idle_cpu(i),
				     sched_irqload(i), cpu_cost);

		if (sched_boost() && capacity(rq) != max_capacity)
			continue;