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

Commit 6d63f38b authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

sched: kill sync_cpu maintenance



We assume boot CPU as a sync CPU and initialize it's window_start
to sched_ktime_clock(). As windows are synchronized across all
CPUs, the secondary CPUs' window_start are initialized from the
sync_cpu's window_start. A CPU's window_start is never reset, so
this synchronization happens only once for a given CPU. Given this
fact, there is no need to reassigning the sync_cpu role to another
CPU when the boot CPU is going offline. Remove this unnecessary
maintenance of sync_cpu and use any online CPU's window_start as
reference.

Change-Id: I169a8e80573c6dbcb1edeab0659c07c17102f4c9
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent ebc5196e
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -5905,7 +5905,6 @@ int sched_isolate_cpu(int cpu)
	smp_call_function_any(&avail_cpus, hrtimer_quiesce_cpu, &cpu, 1);
	smp_call_function_any(&avail_cpus, timer_quiesce_cpu, &cpu, 1);

	migrate_sync_cpu(cpu, cpumask_first(&avail_cpus));
	stop_cpus(cpumask_of(cpu), do_isolation_work_cpu_stop, 0);

	calc_load_migrate(rq);
@@ -6286,7 +6285,6 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
		sched_ttwu_pending();
		/* Update our root-domain */
		raw_spin_lock_irqsave(&rq->lock, flags);
		migrate_sync_cpu(cpu, smp_processor_id());

		if (rq->rd) {
			BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));
+6 −12
Original line number Diff line number Diff line
@@ -788,8 +788,6 @@ __read_mostly unsigned int sched_ravg_window = MIN_SCHED_RAVG_WINDOW;
/* Temporarily disable window-stats activity on all cpus */
unsigned int __read_mostly sched_disable_window_stats;

static unsigned int sync_cpu;

struct related_thread_group *related_thread_groups[MAX_NUM_CGROUP_COLOC_ID];
static LIST_HEAD(active_related_thread_groups);
static DEFINE_RWLOCK(related_thread_group_lock);
@@ -3015,18 +3013,20 @@ void mark_task_starting(struct task_struct *p)

void set_window_start(struct rq *rq)
{
	int cpu = cpu_of(rq);
	struct rq *sync_rq = cpu_rq(sync_cpu);
	static int sync_cpu_available;

	if (rq->window_start || !sched_enable_hmp)
		return;

	if (cpu == sync_cpu) {
	if (!sync_cpu_available) {
		rq->window_start = sched_ktime_clock();
		sync_cpu_available = 1;
	} else {
		struct rq *sync_rq = cpu_rq(cpumask_any(cpu_online_mask));

		raw_spin_unlock(&rq->lock);
		double_rq_lock(rq, sync_rq);
		rq->window_start = cpu_rq(sync_cpu)->window_start;
		rq->window_start = sync_rq->window_start;
		rq->curr_runnable_sum = rq->prev_runnable_sum = 0;
		rq->nt_curr_runnable_sum = rq->nt_prev_runnable_sum = 0;
		raw_spin_unlock(&sync_rq->lock);
@@ -3035,12 +3035,6 @@ void set_window_start(struct rq *rq)
	rq->curr->ravg.mark_start = rq->window_start;
}

void migrate_sync_cpu(int cpu, int new_cpu)
{
	if (cpu == sync_cpu)
		sync_cpu = new_cpu;
}

static void reset_all_task_stats(void)
{
	struct task_struct *g, *p;
+0 −2
Original line number Diff line number Diff line
@@ -1123,7 +1123,6 @@ extern void clear_boost_kick(int cpu);
extern void clear_hmp_request(int cpu);
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 note_task_waking(struct task_struct *p, u64 wallclock);
extern void set_task_last_switch_out(struct task_struct *p, u64 wallclock);
@@ -1525,7 +1524,6 @@ static inline void clear_boost_kick(int cpu) { }
static inline void clear_hmp_request(int cpu) { }
static inline void mark_task_starting(struct task_struct *p) { }
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 note_task_waking(struct task_struct *p, u64 wallclock) { }