diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2018-04-26 06:30:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2018-05-04 04:00:08 -0400 |
commit | c976a862ba4869c1e75c39b9b8f1e9ebfe90cdfc (patch) | |
tree | 00d6e6fe00a742000db7219a8a24d206857acb25 | |
parent | f1d88b4468188ddcd2620b8d612068faf6662a62 (diff) |
sched/fair: Avoid calling sync_entity_load_avg() unnecessarily
Call sync_entity_load_avg() directly from find_idlest_cpu() instead of
select_task_rq_fair(), as that's where we need to use task's utilization
value. And call sync_entity_load_avg() only after making sure sched
domain spans over one of the allowed CPUs for the task.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Link: http://lkml.kernel.org/r/cd019d1753824c81130eae7b43e2bbcec47cc1ad.1524738578.git.viresh.kumar@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | kernel/sched/fair.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 4b346f358005..1f6a23a5b451 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -6199,6 +6199,13 @@ static inline int find_idlest_cpu(struct sched_domain *sd, struct task_struct *p | |||
6199 | if (!cpumask_intersects(sched_domain_span(sd), &p->cpus_allowed)) | 6199 | if (!cpumask_intersects(sched_domain_span(sd), &p->cpus_allowed)) |
6200 | return prev_cpu; | 6200 | return prev_cpu; |
6201 | 6201 | ||
6202 | /* | ||
6203 | * We need task's util for capacity_spare_wake, sync it up to prev_cpu's | ||
6204 | * last_update_time. | ||
6205 | */ | ||
6206 | if (!(sd_flag & SD_BALANCE_FORK)) | ||
6207 | sync_entity_load_avg(&p->se); | ||
6208 | |||
6202 | while (sd) { | 6209 | while (sd) { |
6203 | struct sched_group *group; | 6210 | struct sched_group *group; |
6204 | struct sched_domain *tmp; | 6211 | struct sched_domain *tmp; |
@@ -6651,15 +6658,6 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f | |||
6651 | 6658 | ||
6652 | if (unlikely(sd)) { | 6659 | if (unlikely(sd)) { |
6653 | /* Slow path */ | 6660 | /* Slow path */ |
6654 | |||
6655 | /* | ||
6656 | * We're going to need the task's util for capacity_spare_wake | ||
6657 | * in find_idlest_group. Sync it up to prev_cpu's | ||
6658 | * last_update_time. | ||
6659 | */ | ||
6660 | if (!(sd_flag & SD_BALANCE_FORK)) | ||
6661 | sync_entity_load_avg(&p->se); | ||
6662 | |||
6663 | new_cpu = find_idlest_cpu(sd, p, cpu, prev_cpu, sd_flag); | 6661 | new_cpu = find_idlest_cpu(sd, p, cpu, prev_cpu, sd_flag); |
6664 | } else if (sd_flag & SD_BALANCE_WAKE) { /* XXX always ? */ | 6662 | } else if (sd_flag & SD_BALANCE_WAKE) { /* XXX always ? */ |
6665 | /* Fast path */ | 6663 | /* Fast path */ |