diff options
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index fcc3483e9955..5faf5d482fcd 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2317,16 +2317,6 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync) | |||
2317 | if (!sched_feat(SYNC_WAKEUPS)) | 2317 | if (!sched_feat(SYNC_WAKEUPS)) |
2318 | sync = 0; | 2318 | sync = 0; |
2319 | 2319 | ||
2320 | if (!sync) { | ||
2321 | if (current->se.avg_overlap < sysctl_sched_migration_cost && | ||
2322 | p->se.avg_overlap < sysctl_sched_migration_cost) | ||
2323 | sync = 1; | ||
2324 | } else { | ||
2325 | if (current->se.avg_overlap >= sysctl_sched_migration_cost || | ||
2326 | p->se.avg_overlap >= sysctl_sched_migration_cost) | ||
2327 | sync = 0; | ||
2328 | } | ||
2329 | |||
2330 | #ifdef CONFIG_SMP | 2320 | #ifdef CONFIG_SMP |
2331 | if (sched_feat(LB_WAKEUP_UPDATE)) { | 2321 | if (sched_feat(LB_WAKEUP_UPDATE)) { |
2332 | struct sched_domain *sd; | 2322 | struct sched_domain *sd; |
@@ -7045,20 +7035,26 @@ static void free_rootdomain(struct root_domain *rd) | |||
7045 | 7035 | ||
7046 | static void rq_attach_root(struct rq *rq, struct root_domain *rd) | 7036 | static void rq_attach_root(struct rq *rq, struct root_domain *rd) |
7047 | { | 7037 | { |
7038 | struct root_domain *old_rd = NULL; | ||
7048 | unsigned long flags; | 7039 | unsigned long flags; |
7049 | 7040 | ||
7050 | spin_lock_irqsave(&rq->lock, flags); | 7041 | spin_lock_irqsave(&rq->lock, flags); |
7051 | 7042 | ||
7052 | if (rq->rd) { | 7043 | if (rq->rd) { |
7053 | struct root_domain *old_rd = rq->rd; | 7044 | old_rd = rq->rd; |
7054 | 7045 | ||
7055 | if (cpumask_test_cpu(rq->cpu, old_rd->online)) | 7046 | if (cpumask_test_cpu(rq->cpu, old_rd->online)) |
7056 | set_rq_offline(rq); | 7047 | set_rq_offline(rq); |
7057 | 7048 | ||
7058 | cpumask_clear_cpu(rq->cpu, old_rd->span); | 7049 | cpumask_clear_cpu(rq->cpu, old_rd->span); |
7059 | 7050 | ||
7060 | if (atomic_dec_and_test(&old_rd->refcount)) | 7051 | /* |
7061 | free_rootdomain(old_rd); | 7052 | * If we dont want to free the old_rt yet then |
7053 | * set old_rd to NULL to skip the freeing later | ||
7054 | * in this function: | ||
7055 | */ | ||
7056 | if (!atomic_dec_and_test(&old_rd->refcount)) | ||
7057 | old_rd = NULL; | ||
7062 | } | 7058 | } |
7063 | 7059 | ||
7064 | atomic_inc(&rd->refcount); | 7060 | atomic_inc(&rd->refcount); |
@@ -7069,6 +7065,9 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd) | |||
7069 | set_rq_online(rq); | 7065 | set_rq_online(rq); |
7070 | 7066 | ||
7071 | spin_unlock_irqrestore(&rq->lock, flags); | 7067 | spin_unlock_irqrestore(&rq->lock, flags); |
7068 | |||
7069 | if (old_rd) | ||
7070 | free_rootdomain(old_rd); | ||
7072 | } | 7071 | } |
7073 | 7072 | ||
7074 | static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) | 7073 | static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) |