From 5d36b2e7e304e4eecc4e98f628298ccc0ce769ed Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Wed, 29 Jul 2009 00:21:23 -0400 Subject: [PATCH] --- yaml --- r: 158335 b: refs/heads/master c: c3a2ae3d93c0f10d29c071f599764d00b8de00cb h: refs/heads/master i: 158333: ec78e8248a229f03b95e5a7609b1ca49023233fa 158331: 47907a6ee37d31f68818c46d753d661f3cb17fbe 158327: 2b24aff92403577e105e565f12e4664dd2effac7 158319: c7461e1bd144568ed995a303ccaf72ec26d52f89 158303: 0809c0f6589ca654a386352b072d76630ec4c9f4 158271: da7a6022d2a35fb3744467a51ba5998d68fdd412 158207: 09c818ffd82f75cdad1376b6f2cbc9b05d5de57e v: v3 --- [refs] | 2 +- trunk/kernel/sched_cpupri.c | 30 ++++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index ba91e89def96..685c062bc35e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: da19ab510343c6496fe8b8f890091296032025c9 +refs/heads/master: c3a2ae3d93c0f10d29c071f599764d00b8de00cb diff --git a/trunk/kernel/sched_cpupri.c b/trunk/kernel/sched_cpupri.c index d014efbf947a..0f052fc674d5 100644 --- a/trunk/kernel/sched_cpupri.c +++ b/trunk/kernel/sched_cpupri.c @@ -127,21 +127,11 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri) /* * If the cpu was currently mapped to a different value, we - * first need to unmap the old value + * need to map it to the new value then remove the old value. + * Note, we must add the new value first, otherwise we risk the + * cpu being cleared from pri_active, and this cpu could be + * missed for a push or pull. */ - if (likely(oldpri != CPUPRI_INVALID)) { - struct cpupri_vec *vec = &cp->pri_to_cpu[oldpri]; - - spin_lock_irqsave(&vec->lock, flags); - - vec->count--; - if (!vec->count) - clear_bit(oldpri, cp->pri_active); - cpumask_clear_cpu(cpu, vec->mask); - - spin_unlock_irqrestore(&vec->lock, flags); - } - if (likely(newpri != CPUPRI_INVALID)) { struct cpupri_vec *vec = &cp->pri_to_cpu[newpri]; @@ -154,6 +144,18 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri) spin_unlock_irqrestore(&vec->lock, flags); } + if (likely(oldpri != CPUPRI_INVALID)) { + struct cpupri_vec *vec = &cp->pri_to_cpu[oldpri]; + + spin_lock_irqsave(&vec->lock, flags); + + vec->count--; + if (!vec->count) + clear_bit(oldpri, cp->pri_active); + cpumask_clear_cpu(cpu, vec->mask); + + spin_unlock_irqrestore(&vec->lock, flags); + } *currpri = newpri; }