aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-02-24 15:52:27 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-24 15:52:27 -0500
commit87b203079ed949de52f0d92aeae20e5e0116c12f (patch)
tree1878756f936963822ed2d51a15db1da5814973e7 /kernel/sched.c
parent58105ef1857112a186696c9b8957020090226a28 (diff)
parenta852cbfaaf8122827602027b1614971cfd832304 (diff)
Merge branch 'x86/core' into core/percpu
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index fc17fd91ab57..7d97ff7c4478 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2266,16 +2266,6 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
2266 if (!sched_feat(SYNC_WAKEUPS)) 2266 if (!sched_feat(SYNC_WAKEUPS))
2267 sync = 0; 2267 sync = 0;
2268 2268
2269 if (!sync) {
2270 if (current->se.avg_overlap < sysctl_sched_migration_cost &&
2271 p->se.avg_overlap < sysctl_sched_migration_cost)
2272 sync = 1;
2273 } else {
2274 if (current->se.avg_overlap >= sysctl_sched_migration_cost ||
2275 p->se.avg_overlap >= sysctl_sched_migration_cost)
2276 sync = 0;
2277 }
2278
2279#ifdef CONFIG_SMP 2269#ifdef CONFIG_SMP
2280 if (sched_feat(LB_WAKEUP_UPDATE)) { 2270 if (sched_feat(LB_WAKEUP_UPDATE)) {
2281 struct sched_domain *sd; 2271 struct sched_domain *sd;
@@ -3890,19 +3880,24 @@ int select_nohz_load_balancer(int stop_tick)
3890 int cpu = smp_processor_id(); 3880 int cpu = smp_processor_id();
3891 3881
3892 if (stop_tick) { 3882 if (stop_tick) {
3893 cpumask_set_cpu(cpu, nohz.cpu_mask);
3894 cpu_rq(cpu)->in_nohz_recently = 1; 3883 cpu_rq(cpu)->in_nohz_recently = 1;
3895 3884
3896 /* 3885 if (!cpu_active(cpu)) {
3897 * If we are going offline and still the leader, give up! 3886 if (atomic_read(&nohz.load_balancer) != cpu)
3898 */ 3887 return 0;
3899 if (!cpu_active(cpu) && 3888
3900 atomic_read(&nohz.load_balancer) == cpu) { 3889 /*
3890 * If we are going offline and still the leader,
3891 * give up!
3892 */
3901 if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu) 3893 if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)
3902 BUG(); 3894 BUG();
3895
3903 return 0; 3896 return 0;
3904 } 3897 }
3905 3898
3899 cpumask_set_cpu(cpu, nohz.cpu_mask);
3900
3906 /* time for ilb owner also to sleep */ 3901 /* time for ilb owner also to sleep */
3907 if (cpumask_weight(nohz.cpu_mask) == num_online_cpus()) { 3902 if (cpumask_weight(nohz.cpu_mask) == num_online_cpus()) {
3908 if (atomic_read(&nohz.load_balancer) == cpu) 3903 if (atomic_read(&nohz.load_balancer) == cpu)
@@ -6944,20 +6939,26 @@ static void free_rootdomain(struct root_domain *rd)
6944 6939
6945static void rq_attach_root(struct rq *rq, struct root_domain *rd) 6940static void rq_attach_root(struct rq *rq, struct root_domain *rd)
6946{ 6941{
6942 struct root_domain *old_rd = NULL;
6947 unsigned long flags; 6943 unsigned long flags;
6948 6944
6949 spin_lock_irqsave(&rq->lock, flags); 6945 spin_lock_irqsave(&rq->lock, flags);
6950 6946
6951 if (rq->rd) { 6947 if (rq->rd) {
6952 struct root_domain *old_rd = rq->rd; 6948 old_rd = rq->rd;
6953 6949
6954 if (cpumask_test_cpu(rq->cpu, old_rd->online)) 6950 if (cpumask_test_cpu(rq->cpu, old_rd->online))
6955 set_rq_offline(rq); 6951 set_rq_offline(rq);
6956 6952
6957 cpumask_clear_cpu(rq->cpu, old_rd->span); 6953 cpumask_clear_cpu(rq->cpu, old_rd->span);
6958 6954
6959 if (atomic_dec_and_test(&old_rd->refcount)) 6955 /*
6960 free_rootdomain(old_rd); 6956 * If we dont want to free the old_rt yet then
6957 * set old_rd to NULL to skip the freeing later
6958 * in this function:
6959 */
6960 if (!atomic_dec_and_test(&old_rd->refcount))
6961 old_rd = NULL;
6961 } 6962 }
6962 6963
6963 atomic_inc(&rd->refcount); 6964 atomic_inc(&rd->refcount);
@@ -6968,6 +6969,9 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd)
6968 set_rq_online(rq); 6969 set_rq_online(rq);
6969 6970
6970 spin_unlock_irqrestore(&rq->lock, flags); 6971 spin_unlock_irqrestore(&rq->lock, flags);
6972
6973 if (old_rd)
6974 free_rootdomain(old_rd);
6971} 6975}
6972 6976
6973static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) 6977static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem)