]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
sched: fix incorrect assumption that cpu 0 exists
authorJames Bottomley <James.Bottomley@SteelEye.com>
Mon, 29 Oct 2007 20:18:11 +0000 (21:18 +0100)
committerIngo Molnar <mingo@elte.hu>
Mon, 29 Oct 2007 20:18:11 +0000 (21:18 +0100)
This patch:

commit 9b5b77512dce239fa168183fa71896712232e95a
Author: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
Date:   Mon Oct 15 17:00:09 2007 +0200

    sched: clean up code under CONFIG_FAIR_GROUP_SCHED

Introduced an assumption of the existence of CPU0 via this line

cfs_rq = tg->cfs_rq[0];

If you have no CPU0, that will be NULL.  The fix seems to be just to
take whatever cfs_rq queue comes out of the for_each_possible_cpu()
loop, since they're all equally good for the destruction operation.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/sched.c

index 74dbb4020cf50a731e91f7a61906ab43eac306fc..235952b100ebbe64646a50980c3e30a18ba69d90 100644 (file)
@@ -7041,7 +7041,7 @@ static void free_sched_group(struct rcu_head *rhp)
 /* Destroy runqueue etc associated with a task group */
 void sched_destroy_group(struct task_group *tg)
 {
-       struct cfs_rq *cfs_rq;
+       struct cfs_rq *cfs_rq = NULL;
        int i;
 
        for_each_possible_cpu(i) {
@@ -7049,7 +7049,7 @@ void sched_destroy_group(struct task_group *tg)
                list_del_rcu(&cfs_rq->leaf_cfs_rq_list);
        }
 
-       cfs_rq = tg->cfs_rq[0];
+       BUG_ON(!cfs_rq);
 
        /* wait for possible concurrent references to cfs_rqs complete */
        call_rcu(&cfs_rq->rcu, free_sched_group);