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

Commit 5a66e9b7 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "sched: Track average sleep time"

parents e26b0777 92dc2845
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1395,7 +1395,7 @@ struct ravg {
	u32 sum_history[RAVG_HIST_SIZE_MAX];
	u32 *curr_window_cpu, *prev_window_cpu;
	u32 curr_window, prev_window;
	u64 curr_burst, avg_burst;
	u64 curr_burst, avg_burst, avg_sleep_time;
	u16 active_windows;
	u32 pred_demand;
	u8 busy_buckets[NUM_BUSY_BUCKETS];
+5 −2
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ TRACE_EVENT(sched_task_load,
		__field(	u64,	latency			)
		__field(	int,	grp_id			)
		__field(	u64,	avg_burst		)
		__field(	u64,	avg_sleep		)
	),

	TP_fast_assign(
@@ -152,13 +153,15 @@ TRACE_EVENT(sched_task_load,
						      p->ravg.mark_start : 0;
		__entry->grp_id		= p->grp ? p->grp->id : 0;
		__entry->avg_burst	= p->ravg.avg_burst;
		__entry->avg_sleep	= p->ravg.avg_sleep_time;
	),

	TP_printk("%d (%s): demand=%u boost=%d reason=%d sync=%d need_idle=%d flags=%x grp=%d best_cpu=%d latency=%llu avg_burst=%llu",
	TP_printk("%d (%s): demand=%u boost=%d reason=%d sync=%d need_idle=%d flags=%x grp=%d best_cpu=%d latency=%llu avg_burst=%llu avg_sleep=%llu",
		__entry->pid, __entry->comm, __entry->demand,
		__entry->boost, __entry->reason, __entry->sync,
		__entry->need_idle, __entry->flags, __entry->grp_id,
		__entry->best_cpu, __entry->latency, __entry->avg_burst)
		__entry->best_cpu, __entry->latency, __entry->avg_burst,
		__entry->avg_sleep)
);

TRACE_EVENT(sched_set_preferred_cluster,
+2 −2
Original line number Diff line number Diff line
@@ -2115,7 +2115,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
		set_task_cpu(p, cpu);
	}

	set_task_last_wake(p, wallclock);
	note_task_waking(p, wallclock);
#endif /* CONFIG_SMP */
	ttwu_queue(p, cpu);
stat:
@@ -2184,7 +2184,7 @@ static void try_to_wake_up_local(struct task_struct *p)
		update_task_ravg(rq->curr, rq, TASK_UPDATE, wallclock, 0);
		update_task_ravg(p, rq, TASK_WAKE, wallclock, 0);
		ttwu_activate(rq, p, ENQUEUE_WAKEUP);
		set_task_last_wake(p, wallclock);
		note_task_waking(p, wallclock);
	}

	ttwu_do_wakeup(rq, p, 0);
+9 −5
Original line number Diff line number Diff line
@@ -74,11 +74,6 @@ inline void clear_ed_task(struct task_struct *p, struct rq *rq)
		rq->ed_task = NULL;
}

inline void set_task_last_wake(struct task_struct *p, u64 wallclock)
{
	p->last_wake_ts = wallclock;
}

inline void set_task_last_switch_out(struct task_struct *p, u64 wallclock)
{
	p->last_switch_out_ts = wallclock;
@@ -1567,6 +1562,7 @@ void init_new_task_load(struct task_struct *p, bool idle_task)
	 * the avg_burst to go below the threshold.
	 */
	p->ravg.avg_burst = 2 * (u64)sysctl_sched_short_burst;
	p->ravg.avg_sleep_time = 0;

	p->ravg.curr_window_cpu = kcalloc(nr_cpu_ids, sizeof(u32), GFP_KERNEL);
	p->ravg.prev_window_cpu = kcalloc(nr_cpu_ids, sizeof(u32), GFP_KERNEL);
@@ -4510,6 +4506,14 @@ void update_avg_burst(struct task_struct *p)
	p->ravg.curr_burst = 0;
}

void note_task_waking(struct task_struct *p, u64 wallclock)
{
	u64 sleep_time = wallclock - p->last_switch_out_ts;

	p->last_wake_ts = wallclock;
	update_avg(&p->ravg.avg_sleep_time, sleep_time);
}

#ifdef CONFIG_CGROUP_SCHED
u64 cpu_upmigrate_discourage_read_u64(struct cgroup_subsys_state *css,
					  struct cftype *cft)
+2 −2
Original line number Diff line number Diff line
@@ -1120,7 +1120,7 @@ extern void mark_task_starting(struct task_struct *p);
extern void set_window_start(struct rq *rq);
extern void migrate_sync_cpu(int cpu, int new_cpu);
extern void update_cluster_topology(void);
extern void set_task_last_wake(struct task_struct *p, u64 wallclock);
extern void note_task_waking(struct task_struct *p, u64 wallclock);
extern void set_task_last_switch_out(struct task_struct *p, u64 wallclock);
extern void init_clusters(void);
extern int __init set_sched_enable_hmp(char *str);
@@ -1518,7 +1518,7 @@ static inline void set_window_start(struct rq *rq) { }
static inline void migrate_sync_cpu(int cpu, int new_cpu) {}
static inline void init_clusters(void) {}
static inline void update_cluster_topology(void) { }
static inline void set_task_last_wake(struct task_struct *p, u64 wallclock) { }
static inline void note_task_waking(struct task_struct *p, u64 wallclock) { }
static inline void set_task_last_switch_out(struct task_struct *p,
					    u64 wallclock) { }