Commit 837c3c59 authored by Mel Gorman's avatar Mel Gorman Committed by Zheng Zengkai
Browse files

sched/fair: Remove SIS_AVG_CPU

mainline inclusion
from mainline-5.12-rc1
commit e6e0dc2d
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I41A4K
CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e6e0dc2d5497f7f3ed970052917e2923c6f453f4



---------------------------

SIS_AVG_CPU was introduced as a means of avoiding a search when the
average search cost indicated that the search would likely fail. It was
a blunt instrument and disabled by commit 4c77b18c ("sched/fair: Make
select_idle_cpu() more aggressive") and later replaced with a proportional
search depth by commit 1ad3aaf3 ("sched/core: Implement new approach
to scale select_idle_cpu()").

While there are corner cases where SIS_AVG_CPU is better, it has now been
disabled for almost three years. As the intent of SIS_PROP is to reduce
the time complexity of select_idle_cpu(), lets drop SIS_AVG_CPU and focus
on SIS_PROP as a throttling mechanism.

Signed-off-by: default avatarMel Gorman <mgorman@techsingularity.net>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20210125085909.4600-2-mgorman@techsingularity.net


Signed-off-by: default avatarZheng Zucheng <zhengzucheng@huawei.com>
Reviewed-by: default avatarChen Hui <judy.chenhui@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 34df857d
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -6170,7 +6170,6 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
{
	struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_idle_mask);
	struct sched_domain *this_sd;
	u64 avg_cost, avg_idle;
	u64 time;
	int this = smp_processor_id();
	int cpu, nr = INT_MAX;
@@ -6179,18 +6178,17 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
	if (!this_sd)
		return -1;

	if (sched_feat(SIS_PROP)) {
		u64 avg_cost, avg_idle, span_avg;

		/*
	 * Due to large variance we need a large fuzz factor; hackbench in
	 * particularly is sensitive here.
		 * Due to large variance we need a large fuzz factor;
		 * hackbench in particularly is sensitive here.
		 */
		avg_idle = this_rq()->avg_idle / 512;
		avg_cost = this_sd->avg_scan_cost + 1;

	if (sched_feat(SIS_AVG_CPU) && avg_idle < avg_cost)
		return -1;

	if (sched_feat(SIS_PROP)) {
		u64 span_avg = sd->span_weight * avg_idle;
		span_avg = sd->span_weight * avg_idle;
		if (span_avg > 4*avg_cost)
			nr = div_u64(span_avg, avg_cost);
		else
+0 −1
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ SCHED_FEAT(TTWU_QUEUE, true)
/*
 * When doing wakeups, attempt to limit superfluous scans of the LLC domain.
 */
SCHED_FEAT(SIS_AVG_CPU, false)
SCHED_FEAT(SIS_PROP, true)

/*