aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 5530ed211f72..ba053d88c8c6 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -223,6 +223,7 @@ struct rq {
223 unsigned long raw_weighted_load; 223 unsigned long raw_weighted_load;
224#ifdef CONFIG_SMP 224#ifdef CONFIG_SMP
225 unsigned long cpu_load[3]; 225 unsigned long cpu_load[3];
226 unsigned char idle_at_tick;
226#endif 227#endif
227 unsigned long long nr_switches; 228 unsigned long long nr_switches;
228 229
@@ -2943,12 +2944,7 @@ static void run_rebalance_domains(struct softirq_action *h)
2943 struct rq *this_rq = cpu_rq(this_cpu); 2944 struct rq *this_rq = cpu_rq(this_cpu);
2944 unsigned long interval; 2945 unsigned long interval;
2945 struct sched_domain *sd; 2946 struct sched_domain *sd;
2946 /* 2947 enum idle_type idle = this_rq->idle_at_tick ? SCHED_IDLE : NOT_IDLE;
2947 * We are idle if there are no processes running. This
2948 * is valid even if we are the idle process (SMT).
2949 */
2950 enum idle_type idle = !this_rq->nr_running ?
2951 SCHED_IDLE : NOT_IDLE;
2952 /* Earliest time when we have to call run_rebalance_domains again */ 2948 /* Earliest time when we have to call run_rebalance_domains again */
2953 unsigned long next_balance = jiffies + 60*HZ; 2949 unsigned long next_balance = jiffies + 60*HZ;
2954 2950
@@ -3218,14 +3214,16 @@ void scheduler_tick(void)
3218 unsigned long long now = sched_clock(); 3214 unsigned long long now = sched_clock();
3219 struct task_struct *p = current; 3215 struct task_struct *p = current;
3220 int cpu = smp_processor_id(); 3216 int cpu = smp_processor_id();
3217 int idle_at_tick = idle_cpu(cpu);
3221 struct rq *rq = cpu_rq(cpu); 3218 struct rq *rq = cpu_rq(cpu);
3222 3219
3223 update_cpu_clock(p, rq, now); 3220 update_cpu_clock(p, rq, now);
3224 3221
3225 if (p != rq->idle) 3222 if (!idle_at_tick)
3226 task_running_tick(rq, p); 3223 task_running_tick(rq, p);
3227#ifdef CONFIG_SMP 3224#ifdef CONFIG_SMP
3228 update_load(rq); 3225 update_load(rq);
3226 rq->idle_at_tick = idle_at_tick;
3229 if (time_after_eq(jiffies, rq->next_balance)) 3227 if (time_after_eq(jiffies, rq->next_balance))
3230 raise_softirq(SCHED_SOFTIRQ); 3228 raise_softirq(SCHED_SOFTIRQ);
3231#endif 3229#endif