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

Commit 04d07a9b authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

sched/fair: Improve the scheduler



This change is for general scheduler improvement.

Change-Id: I9216f9316e2bad067c10762de8d67912826b7bc7
Signed-off-by: default avatarMaria Yu <aiquny@codeaurora.org>
Co-developed-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
[pkondeti@codeaurora.org: skip_cpu argument is implemented for fbt]
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 4770b12d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ extern unsigned int sysctl_sched_cpu_high_irqload;
extern unsigned int sysctl_sched_boost;
extern unsigned int sysctl_sched_group_upmigrate_pct;
extern unsigned int sysctl_sched_group_downmigrate_pct;
extern unsigned int sysctl_sched_many_wakeup_threshold;
extern unsigned int sysctl_sched_walt_rotate_big_tasks;
extern unsigned int sysctl_sched_min_task_util_for_boost;
extern unsigned int sysctl_sched_min_task_util_for_colocation;
+23 −4
Original line number Diff line number Diff line
@@ -7395,6 +7395,7 @@ struct find_best_target_env {
	int placement_boost;
	bool need_idle;
	int fastpath;
	int skip_cpu;
};

static bool is_packing_eligible(struct task_struct *p, int target_cpu,
@@ -7568,6 +7569,9 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
			if (sched_cpu_high_irqload(i))
				continue;

			if (fbt_env->skip_cpu == i)
				continue;

			/*
			 * p's blocked utilization is still accounted for on prev_cpu
			 * so prev_cpu will receive a negative bias due to the double
@@ -8126,11 +8130,22 @@ static inline struct cpumask *find_rtg_target(struct task_struct *p)

	return rtg_target;
}

static inline bool is_many_wakeup(int sibling_count_hint)
{
	return sibling_count_hint >= sysctl_sched_many_wakeup_threshold;
}

#else
static inline struct cpumask *find_rtg_target(struct task_struct *p)
{
	return NULL;
}

static inline bool is_many_wakeup(int sibling_count_hint)
{
	return false;
}
#endif

/*
@@ -8141,7 +8156,7 @@ static inline struct cpumask *find_rtg_target(struct task_struct *p)
static int find_energy_efficient_cpu(struct sched_domain *sd,
				     struct task_struct *p,
				     int cpu, int prev_cpu,
				     int sync)
				     int sync, int sibling_count_hint)
{
	int use_fbt = sched_feat(FIND_BEST_TARGET);
	int cpu_iter, eas_cpu_idx = EAS_CPU_NXT;
@@ -8225,6 +8240,8 @@ static int find_energy_efficient_cpu(struct sched_domain *sd,
		fbt_env.rtg_target = rtg_target;
		fbt_env.placement_boost = placement_boost;
		fbt_env.need_idle = need_idle;
		fbt_env.skip_cpu = is_many_wakeup(sibling_count_hint) ?
				   cpu : -1;

		/* Find a cpu with sufficient capacity */
		target_cpu = find_best_target(p, &eenv->cpu[EAS_CPU_BKP].cpu_id,
@@ -8365,7 +8382,8 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
	if (energy_aware()) {
		rcu_read_lock();
		new_cpu = find_energy_efficient_cpu(energy_sd, p,
						cpu, prev_cpu, sync);
						cpu, prev_cpu, sync,
						sibling_count_hint);
		rcu_read_unlock();
		return new_cpu;
	}
@@ -8439,7 +8457,8 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f

	} else {
		if (energy_sd)
			new_cpu = find_energy_efficient_cpu(energy_sd, p, cpu, prev_cpu, sync);
			new_cpu = find_energy_efficient_cpu(energy_sd, p, cpu,
					prev_cpu, sync, sibling_count_hint);

		/* if we did an energy-aware placement and had no choices available
		 * then fall back to the default find_idlest_cpu choice
@@ -13102,7 +13121,7 @@ void check_for_migration(struct rq *rq, struct task_struct *p)

		raw_spin_lock(&migration_lock);
		rcu_read_lock();
		new_cpu = find_energy_efficient_cpu(sd, p, cpu,	prev_cpu, 0);
		new_cpu = find_energy_efficient_cpu(sd, p, cpu, prev_cpu, 0, 1);
		rcu_read_unlock();
		if ((new_cpu != prev_cpu) && (capacity_orig_of(new_cpu) >
					capacity_orig_of(prev_cpu))) {
+2 −0
Original line number Diff line number Diff line
@@ -922,6 +922,8 @@ void set_window_start(struct rq *rq)
unsigned int max_possible_efficiency = 1;
unsigned int min_possible_efficiency = UINT_MAX;

unsigned int sysctl_sched_many_wakeup_threshold = 1000;

#define INC_STEP 8
#define DEC_STEP 2
#define CONSISTENT_THRES 16
+9 −0
Original line number Diff line number Diff line
@@ -370,6 +370,15 @@ static struct ctl_table kern_table[] = {
		.extra1		= &neg_three,
		.extra2		= &three,
	},
	{
		.procname	= "sched_many_wakeup_threshold",
		.data		= &sysctl_sched_many_wakeup_threshold,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &two,
		.extra2		= &one_thousand,
	},
	{
		.procname	= "sched_walt_rotate_big_tasks",
		.data		= &sysctl_sched_walt_rotate_big_tasks,