diff options
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/fair.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 8dbee9f4ceb2..ed18c74db017 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -3252,25 +3252,18 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu) | |||
3252 | */ | 3252 | */ |
3253 | static int select_idle_sibling(struct task_struct *p, int target) | 3253 | static int select_idle_sibling(struct task_struct *p, int target) |
3254 | { | 3254 | { |
3255 | int cpu = smp_processor_id(); | ||
3256 | int prev_cpu = task_cpu(p); | ||
3257 | struct sched_domain *sd; | 3255 | struct sched_domain *sd; |
3258 | struct sched_group *sg; | 3256 | struct sched_group *sg; |
3259 | int i; | 3257 | int i = task_cpu(p); |
3260 | 3258 | ||
3261 | /* | 3259 | if (idle_cpu(target)) |
3262 | * If the task is going to be woken-up on this cpu and if it is | 3260 | return target; |
3263 | * already idle, then it is the right target. | ||
3264 | */ | ||
3265 | if (target == cpu && idle_cpu(cpu)) | ||
3266 | return cpu; | ||
3267 | 3261 | ||
3268 | /* | 3262 | /* |
3269 | * If the task is going to be woken-up on the cpu where it previously | 3263 | * If the prevous cpu is cache affine and idle, don't be stupid. |
3270 | * ran and if it is currently idle, then it the right target. | ||
3271 | */ | 3264 | */ |
3272 | if (target == prev_cpu && idle_cpu(prev_cpu)) | 3265 | if (i != target && cpus_share_cache(i, target) && idle_cpu(i)) |
3273 | return prev_cpu; | 3266 | return i; |
3274 | 3267 | ||
3275 | /* | 3268 | /* |
3276 | * Otherwise, iterate the domains and find an elegible idle cpu. | 3269 | * Otherwise, iterate the domains and find an elegible idle cpu. |
@@ -3284,7 +3277,7 @@ static int select_idle_sibling(struct task_struct *p, int target) | |||
3284 | goto next; | 3277 | goto next; |
3285 | 3278 | ||
3286 | for_each_cpu(i, sched_group_cpus(sg)) { | 3279 | for_each_cpu(i, sched_group_cpus(sg)) { |
3287 | if (!idle_cpu(i)) | 3280 | if (i == target || !idle_cpu(i)) |
3288 | goto next; | 3281 | goto next; |
3289 | } | 3282 | } |
3290 | 3283 | ||