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

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

Merge "sched/fair: Improve the scheduler"

parents c9e88b14 452a5e39
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -9746,6 +9746,19 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd
			sgs->group_type = group_classify(sg, sgs);
		}

		/*
		 * Disallow moving tasks from asym cap sibling CPUs to other
		 * CPUs (lower capacity) unless the asym cap sibling group has
		 * no capacity to manage the current load.
		 */
		if ((env->sd->flags & SD_ASYM_CPUCAPACITY) &&
			sgs->group_no_capacity &&
			asym_cap_sibling_group_has_capacity(env->dst_cpu,
						env->sd->imbalance_pct)) {
			sgs->group_no_capacity = 0;
			sgs->group_type = group_classify(sg, sgs);
		}

		if (update_sd_pick_busiest(env, sds, sg, sgs)) {
			sds->busiest = sg;
			sds->busiest_stat = *sgs;
+34 −0
Original line number Diff line number Diff line
@@ -2699,6 +2699,35 @@ static inline int asym_cap_siblings(int cpu1, int cpu2)
		cpumask_test_cpu(cpu2, &asym_cap_sibling_cpus));
}

static inline bool asym_cap_sibling_group_has_capacity(int dst_cpu, int margin)
{
	int sib1, sib2;
	int nr_running;
	unsigned long total_util, total_capacity;

	if (cpumask_empty(&asym_cap_sibling_cpus) ||
			cpumask_test_cpu(dst_cpu, &asym_cap_sibling_cpus))
		return false;

	sib1 = cpumask_first(&asym_cap_sibling_cpus);
	sib2 = cpumask_last(&asym_cap_sibling_cpus);

	if (!cpu_active(sib1) || cpu_isolated(sib1) ||
		!cpu_active(sib2) || cpu_isolated(sib2))
		return false;

	nr_running = cpu_rq(sib1)->cfs.h_nr_running +
			cpu_rq(sib2)->cfs.h_nr_running;

	if (nr_running <= 2)
		return true;

	total_capacity = capacity_of(sib1) + capacity_of(sib2);
	total_util = cpu_util(sib1) + cpu_util(sib2);

	return ((total_capacity * 100) > (total_util * margin));
}

static inline int cpu_max_possible_capacity(int cpu)
{
	return cpu_rq(cpu)->cluster->max_possible_capacity;
@@ -2978,6 +3007,11 @@ static inline struct sched_cluster *rq_cluster(struct rq *rq)

static inline int asym_cap_siblings(int cpu1, int cpu2) { return 0; }

static inline bool asym_cap_sibling_group_has_capacity(int dst_cpu, int margin)
{
	return false;
}

static inline void set_preferred_cluster(struct related_thread_group *grp) { }

static inline bool task_in_related_thread_group(struct task_struct *p)