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

Commit 2eefeaa5 authored by Jonathan Avila's avatar Jonathan Avila Committed by Sai Harshini Nimmala
Browse files

sched/walt: Improve the scheduler



This change is for scheduler improvement.

Change-Id: Ie922b3a672686e7a8f52dcaacdea03948e630a1c
Signed-off-by: default avatarJonathan Avila <avilaj@codeaurora.org>
parent 50db4a39
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -602,11 +602,12 @@ struct ravg {
	u32 sum_history[RAVG_HIST_SIZE_MAX];
	u32 sum_history[RAVG_HIST_SIZE_MAX];
	u32 *curr_window_cpu, *prev_window_cpu;
	u32 *curr_window_cpu, *prev_window_cpu;
	u32 curr_window, prev_window;
	u32 curr_window, prev_window;
	u16 active_windows;
	u32 pred_demand;
	u32 pred_demand;
	u8 busy_buckets[NUM_BUSY_BUCKETS];
	u8 busy_buckets[NUM_BUSY_BUCKETS];
	u16 demand_scaled;
	u16 demand_scaled;
	u16 pred_demand_scaled;
	u16 pred_demand_scaled;
	u64 active_time;
	u64 last_win_size;
};
};
#else
#else
static inline void sched_exit(struct task_struct *p) { }
static inline void sched_exit(struct task_struct *p) { }
+4 −4
Original line number Original line Diff line number Diff line
@@ -238,7 +238,7 @@ TRACE_EVENT(sched_update_task_ravg,
		__dynamic_array(u32,		prev_sum, nr_cpu_ids)
		__dynamic_array(u32,		prev_sum, nr_cpu_ids)
		__field(u64,			nt_cs)
		__field(u64,			nt_cs)
		__field(u64,			nt_ps)
		__field(u64,			nt_ps)
		__field(u32,			active_windows)
		__field(u64,			active_time)
		__field(u32,			curr_top)
		__field(u32,			curr_top)
		__field(u32,			prev_top)
		__field(u32,			prev_top)
	),
	),
@@ -276,12 +276,12 @@ TRACE_EVENT(sched_update_task_ravg,
						p->ravg.prev_window_cpu);
						p->ravg.prev_window_cpu);
		__entry->nt_cs		= rq->nt_curr_runnable_sum;
		__entry->nt_cs		= rq->nt_curr_runnable_sum;
		__entry->nt_ps		= rq->nt_prev_runnable_sum;
		__entry->nt_ps		= rq->nt_prev_runnable_sum;
		__entry->active_windows	= p->ravg.active_windows;
		__entry->active_time	= p->ravg.active_time;
		__entry->curr_top	= rq->curr_top;
		__entry->curr_top	= rq->curr_top;
		__entry->prev_top	= rq->prev_top;
		__entry->prev_top	= rq->prev_top;
	),
	),


	TP_printk("wc %llu ws %llu delta %llu event %s cpu %d cur_freq %u cur_pid %d task %d (%s) ms %llu delta %llu demand %u coloc_demand: %u sum %u irqtime %llu pred_demand %u rq_cs %llu rq_ps %llu cur_window %u (%s) prev_window %u (%s) nt_cs %llu nt_ps %llu active_wins %u grp_cs %lld grp_ps %lld, grp_nt_cs %llu, grp_nt_ps: %llu curr_top %u prev_top %u",
	    TP_printk("wc %llu ws %llu delta %llu event %s cpu %d cur_freq %u cur_pid %d task %d (%s) ms %llu delta %llu demand %u coloc_demand: %u sum %u irqtime %llu pred_demand %u rq_cs %llu rq_ps %llu cur_window %u (%s) prev_window %u (%s) nt_cs %llu nt_ps %llu active_time %u grp_cs %lld grp_ps %lld, grp_nt_cs %llu, grp_nt_ps: %llu curr_top %u prev_top %u",
		__entry->wallclock, __entry->win_start, __entry->delta,
		__entry->wallclock, __entry->win_start, __entry->delta,
		task_event_names[__entry->evt], __entry->cpu,
		task_event_names[__entry->evt], __entry->cpu,
		__entry->cur_freq, __entry->cur_pid,
		__entry->cur_freq, __entry->cur_pid,
@@ -293,7 +293,7 @@ TRACE_EVENT(sched_update_task_ravg,
		__entry->prev_window,
		__entry->prev_window,
		__window_print(p, __get_dynamic_array(prev_sum), nr_cpu_ids),
		__window_print(p, __get_dynamic_array(prev_sum), nr_cpu_ids),
		__entry->nt_cs, __entry->nt_ps,
		__entry->nt_cs, __entry->nt_ps,
		__entry->active_windows, __entry->grp_cs,
		__entry->active_time, __entry->grp_cs,
		__entry->grp_ps, __entry->grp_nt_cs, __entry->grp_nt_ps,
		__entry->grp_ps, __entry->grp_nt_cs, __entry->grp_nt_ps,
		__entry->curr_top, __entry->prev_top)
		__entry->curr_top, __entry->prev_top)
);
);
+5 −4
Original line number Original line Diff line number Diff line
@@ -1339,6 +1339,9 @@ static void rollover_task_window(struct task_struct *p, bool full_window)
		p->ravg.prev_window_cpu[i] = curr_cpu_windows[i];
		p->ravg.prev_window_cpu[i] = curr_cpu_windows[i];
		p->ravg.curr_window_cpu[i] = 0;
		p->ravg.curr_window_cpu[i] = 0;
	}
	}

	if (p->ravg.active_time < NEW_TASK_ACTIVE_TIME)
		p->ravg.active_time += p->ravg.last_win_size;
}
}


void sched_set_io_is_busy(int val)
void sched_set_io_is_busy(int val)
@@ -1473,11 +1476,8 @@ static void update_cpu_busy_time(struct task_struct *p, struct rq *rq,
	u32 old_curr_window = p->ravg.curr_window;
	u32 old_curr_window = p->ravg.curr_window;


	new_window = mark_start < window_start;
	new_window = mark_start < window_start;
	if (new_window) {
	if (new_window)
		full_window = (window_start - mark_start) >= window_size;
		full_window = (window_start - mark_start) >= window_size;
		if (p->ravg.active_windows < USHRT_MAX)
			p->ravg.active_windows++;
	}


	new_task = is_new_task(p);
	new_task = is_new_task(p);


@@ -2073,6 +2073,7 @@ void update_task_ravg(struct task_struct *p, struct rq *rq, int event,


done:
done:
	p->ravg.mark_start = wallclock;
	p->ravg.mark_start = wallclock;
	p->ravg.last_win_size = sched_ravg_window;


	run_walt_irq_work(old_window_start, rq);
	run_walt_irq_work(old_window_start, rq);
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -28,7 +28,7 @@
#define for_each_related_thread_group(grp) \
#define for_each_related_thread_group(grp) \
	list_for_each_entry(grp, &active_related_thread_groups, list)
	list_for_each_entry(grp, &active_related_thread_groups, list)


#define SCHED_NEW_TASK_WINDOWS 5
#define NEW_TASK_ACTIVE_TIME 100000000


extern unsigned int sched_ravg_window;
extern unsigned int sched_ravg_window;
extern unsigned int new_sched_ravg_window;
extern unsigned int new_sched_ravg_window;
@@ -195,7 +195,7 @@ scale_load_to_freq(u64 load, unsigned int src_freq, unsigned int dst_freq)


static inline bool is_new_task(struct task_struct *p)
static inline bool is_new_task(struct task_struct *p)
{
{
	return p->ravg.active_windows < SCHED_NEW_TASK_WINDOWS;
	return p->ravg.active_time <= NEW_TASK_ACTIVE_TIME;
}
}


static inline void clear_top_tasks_table(u8 *table)
static inline void clear_top_tasks_table(u8 *table)