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

Commit 9ad039ba authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "sched: fair: Improve sched_task_util trace point"

parents a14d6d85 16974ff6
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -1207,13 +1207,13 @@ TRACE_EVENT(sched_compute_energy,

TRACE_EVENT(sched_task_util,

	TP_PROTO(struct task_struct *p, int best_energy_cpu,
		bool sync, bool need_idle, int fastpath,
	TP_PROTO(struct task_struct *p, unsigned long candidates,
		int best_energy_cpu, bool sync, bool need_idle, int fastpath,
		bool placement_boost, u64 start_t,
		bool stune_boosted, bool is_rtg, bool rtg_skip_min,
		int start_cpu),

	TP_ARGS(p, best_energy_cpu, sync, need_idle, fastpath,
	TP_ARGS(p, candidates, best_energy_cpu, sync, need_idle, fastpath,
		placement_boost, start_t, stune_boosted, is_rtg, rtg_skip_min,
		start_cpu),

@@ -1221,6 +1221,7 @@ TRACE_EVENT(sched_task_util,
		__field(int,		pid)
		__array(char,		comm, TASK_COMM_LEN)
		__field(unsigned long,	util)
		__field(unsigned long,	candidates)
		__field(int,		prev_cpu)
		__field(int,		best_energy_cpu)
		__field(bool,		sync)
@@ -1240,6 +1241,7 @@ TRACE_EVENT(sched_task_util,
		memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
		__entry->util                   = task_util(p);
		__entry->prev_cpu               = task_cpu(p);
		__entry->candidates		= candidates;
		__entry->best_energy_cpu        = best_energy_cpu;
		__entry->sync                   = sync;
		__entry->need_idle              = need_idle;
@@ -1252,10 +1254,10 @@ TRACE_EVENT(sched_task_util,
		__entry->start_cpu		= start_cpu;
	),

	TP_printk("pid=%d comm=%s util=%lu prev_cpu=%d best_energy_cpu=%d sync=%d need_idle=%d fastpath=%d placement_boost=%d latency=%llu stune_boosted=%d is_rtg=%d rtg_skip_min=%d start_cpu=%d",
	TP_printk("pid=%d comm=%s util=%lu prev_cpu=%d candidates=%#lx best_energy_cpu=%d sync=%d need_idle=%d fastpath=%d placement_boost=%d latency=%llu stune_boosted=%d is_rtg=%d rtg_skip_min=%d start_cpu=%d",
		__entry->pid, __entry->comm, __entry->util, __entry->prev_cpu,
		__entry->best_energy_cpu, __entry->sync, __entry->need_idle,
		__entry->fastpath, __entry->placement_boost,
		__entry->candidates, __entry->best_energy_cpu, __entry->sync,
		__entry->need_idle, __entry->fastpath, __entry->placement_boost,
		__entry->latency, __entry->stune_boosted,
		__entry->is_rtg, __entry->rtg_skip_min, __entry->start_cpu)
)
+15 −16
Original line number Diff line number Diff line
@@ -7543,6 +7543,10 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, int sy
	if (trace_sched_task_util_enabled())
		start_t = sched_clock();

	/* Pre-select a set of candidate CPUs. */
	candidates = this_cpu_ptr(&energy_cpus);
	cpumask_clear(candidates);

	if (need_idle)
		sync = 0;

@@ -7572,10 +7576,6 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, int sy
	if (!task_util_est(p))
		goto unlock;

	/* Pre-select a set of candidate CPUs. */
	candidates = this_cpu_ptr(&energy_cpus);
	cpumask_clear(candidates);

	if (sched_feat(FIND_BEST_TARGET)) {
		fbt_env.is_rtg = is_rtg;
		fbt_env.placement_boost = placement_boost;
@@ -7637,22 +7637,21 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, int sy
unlock:
	rcu_read_unlock();

sync_wakeup:
	trace_sched_task_util(p, best_energy_cpu, sync,
			need_idle, fbt_env.fastpath, placement_boost, start_t,
			boosted, is_rtg, get_rtg_status(p), start_cpu);

	/*
	 * Pick the best CPU if prev_cpu cannot be used, or if it saves at
	 * least 6% of the energy used by prev_cpu.
	 * Pick the prev CPU, if best energy CPU can't saves at least 6% of
	 * the energy used by prev_cpu.
	 */
	if (prev_energy == ULONG_MAX)
		return best_energy_cpu;
	if ((prev_energy != ULONG_MAX) && (best_energy_cpu != prev_cpu)  &&
	    ((prev_energy - best_energy) <= prev_energy >> 4))
		best_energy_cpu = prev_cpu;

	if ((prev_energy - best_energy) > (prev_energy >> 4))
		return best_energy_cpu;
sync_wakeup:

	return prev_cpu;
	trace_sched_task_util(p, cpumask_bits(candidates)[0], best_energy_cpu,
			sync, need_idle, fbt_env.fastpath, placement_boost,
			start_t, boosted, is_rtg, get_rtg_status(p), start_cpu);

	return best_energy_cpu;

fail:
	rcu_read_unlock();