]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sched: Fix nr_uninterruptible count
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Fri, 26 Mar 2010 11:22:14 +0000 (12:22 +0100)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Thu, 6 Jan 2011 23:07:51 +0000 (18:07 -0500)
commit cc87f76a601d2d256118f7bab15e35254356ae21 upstream.

The cpuload calculation in calc_load_account_active() assumes
rq->nr_uninterruptible will not change on an offline cpu after
migrate_nr_uninterruptible(). However the recent migrate on wakeup
changes broke that and would result in decrementing the offline cpu's
rq->nr_uninterruptible.

Fix this by accounting the nr_uninterruptible on the waking cpu.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
kernel/sched.c

index e542c1e56b82a7fa7ad26def82c8943d876bdcca..074c4d8ec1d6a42d6794a8b00ba671f8e2f442f9 100644 (file)
@@ -2388,8 +2388,12 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
         *
         * First fix up the nr_uninterruptible count:
         */
-       if (task_contributes_to_load(p))
-               rq->nr_uninterruptible--;
+       if (task_contributes_to_load(p)) {
+               if (likely(cpu_online(orig_cpu)))
+                       rq->nr_uninterruptible--;
+               else
+                       this_rq()->nr_uninterruptible--;
+       }
        p->state = TASK_WAKING;
 
        if (p->sched_class->task_waking)