提交 6d95eb17 编写于 作者: M Mel Gorman 提交者: Zheng Zengkai

sched/fair: Move avg_scan_cost calculations under SIS_PROP

mainline inclusion
from mainline-5.12-rc1
commit bae4ec13
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=bae4ec13640b0915e7dd86da7e65c5d085160571

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

As noted by Vincent Guittot, avg_scan_costs are calculated for SIS_PROP
even if SIS_PROP is disabled. Move the time calculations under a SIS_PROP
check and while we are at it, exclude the cost of initialising the CPU
mask from the average scan cost.
Signed-off-by: NMel Gorman <mgorman@techsingularity.net>
Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: NVincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20210125085909.4600-3-mgorman@techsingularity.netSigned-off-by: NZheng Zucheng <zhengzucheng@huawei.com>
Reviewed-by: NChen Hui <judy.chenhui@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 837c3c59
...@@ -6178,6 +6178,8 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t ...@@ -6178,6 +6178,8 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
if (!this_sd) if (!this_sd)
return -1; return -1;
cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr);
if (sched_feat(SIS_PROP)) { if (sched_feat(SIS_PROP)) {
u64 avg_cost, avg_idle, span_avg; u64 avg_cost, avg_idle, span_avg;
...@@ -6193,11 +6195,9 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t ...@@ -6193,11 +6195,9 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
nr = div_u64(span_avg, avg_cost); nr = div_u64(span_avg, avg_cost);
else else
nr = 4; nr = 4;
}
time = cpu_clock(this);
cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr); time = cpu_clock(this);
}
for_each_cpu_wrap(cpu, cpus, target) { for_each_cpu_wrap(cpu, cpus, target) {
if (!--nr) if (!--nr)
...@@ -6206,8 +6206,10 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t ...@@ -6206,8 +6206,10 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
break; break;
} }
time = cpu_clock(this) - time; if (sched_feat(SIS_PROP)) {
update_avg(&this_sd->avg_scan_cost, time); time = cpu_clock(this) - time;
update_avg(&this_sd->avg_scan_cost, time);
}
return cpu; return cpu;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册