Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3273163

Browse files
msrasmussenIngo Molnar
authored and
Ingo Molnar
committed
sched/fair: Let asymmetric CPU configurations balance at wake-up
Currently, SD_WAKE_AFFINE always takes priority over wakeup balancing ifSD_BALANCE_WAKE is set on the sched_domains. For asymmetricconfigurations SD_WAKE_AFFINE is only desirable if the waking task'scompute demand (utilization) is suitable for the waking CPU and theprevious CPU, and all CPUs within their respectiveSD_SHARE_PKG_RESOURCES domains (sd_llc). If not, let wakeup balancingtake over (find_idlest_{group, cpu}()).This patch makes affine wake-ups conditional on whether both the wakerCPU and the previous CPU has sufficient capacity for the waking task,or not, assuming that the CPU capacities within an SD_SHARE_PKG_RESOURCESdomain (sd_llc) are homogeneous.Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>Acked-by: Vincent Guittot <vincent.guittot@linaro.org>Cc: Linus Torvalds <torvalds@linux-foundation.org>Cc: Mike Galbraith <efault@gmx.de>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Thomas Gleixner <tglx@linutronix.de>Cc: dietmar.eggemann@arm.comCc: freedom.tan@mediatek.comCc: keita.kobayashi.ym@renesas.comCc: mgalbraith@suse.deCc: sgurrappadi@nvidia.comCc: yuyang.du@intel.comLink:http://lkml.kernel.org/r/1469453670-2660-10-git-send-email-morten.rasmussen@arm.comSigned-off-by: Ingo Molnar <mingo@kernel.org>
1 parentcd92bfd commit3273163

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

‎kernel/sched/fair.c‎

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ unsigned int __read_mostly sysctl_sched_shares_window = 10000000UL;
114114
unsignedintsysctl_sched_cfs_bandwidth_slice=5000UL;
115115
#endif
116116

117+
/*
118+
* The margin used when comparing utilization with CPU capacity:
119+
* util * 1024 < capacity * margin
120+
*/
121+
unsignedintcapacity_margin=1280;/* ~20% */
122+
117123
staticinlinevoidupdate_load_add(structload_weight*lw,unsigned longinc)
118124
{
119125
lw->weight+=inc;
@@ -5376,6 +5382,32 @@ static int cpu_util(int cpu)
53765382
return (util >=capacity) ?capacity :util;
53775383
}
53785384

5385+
staticinlineinttask_util(structtask_struct*p)
5386+
{
5387+
returnp->se.avg.util_avg;
5388+
}
5389+
5390+
/*
5391+
* Disable WAKE_AFFINE in the case where task @p doesn't fit in the
5392+
* capacity of either the waking CPU @cpu or the previous CPU @prev_cpu.
5393+
*
5394+
* In that case WAKE_AFFINE doesn't make sense and we'll let
5395+
* BALANCE_WAKE sort things out.
5396+
*/
5397+
staticintwake_cap(structtask_struct*p,intcpu,intprev_cpu)
5398+
{
5399+
longmin_cap,max_cap;
5400+
5401+
min_cap=min(capacity_orig_of(prev_cpu),capacity_orig_of(cpu));
5402+
max_cap=cpu_rq(cpu)->rd->max_cpu_capacity;
5403+
5404+
/* Minimum capacity is close to max, no need to abort wake_affine */
5405+
if (max_cap-min_cap<max_cap >>3)
5406+
return0;
5407+
5408+
returnmin_cap*1024<task_util(p)*capacity_margin;
5409+
}
5410+
53795411
/*
53805412
* select_task_rq_fair: Select target runqueue for the waking task in domains
53815413
* that have the 'sd_flag' flag set. In practice, this is SD_BALANCE_WAKE,
@@ -5399,7 +5431,8 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
53995431

54005432
if (sd_flag&SD_BALANCE_WAKE) {
54015433
record_wakee(p);
5402-
want_affine= !wake_wide(p)&&cpumask_test_cpu(cpu,tsk_cpus_allowed(p));
5434+
want_affine= !wake_wide(p)&& !wake_cap(p,cpu,prev_cpu)
5435+
&&cpumask_test_cpu(cpu,tsk_cpus_allowed(p));
54035436
}
54045437

54055438
rcu_read_lock();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp