diff options
Diffstat (limited to 'kernel/sched_cpupri.c')
-rw-r--r-- | kernel/sched_cpupri.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/sched_cpupri.c b/kernel/sched_cpupri.c index 0f052fc674d5..eeb3506c4834 100644 --- a/kernel/sched_cpupri.c +++ b/kernel/sched_cpupri.c | |||
@@ -47,9 +47,7 @@ static int convert_prio(int prio) | |||
47 | } | 47 | } |
48 | 48 | ||
49 | #define for_each_cpupri_active(array, idx) \ | 49 | #define for_each_cpupri_active(array, idx) \ |
50 | for (idx = find_first_bit(array, CPUPRI_NR_PRIORITIES); \ | 50 | for_each_bit(idx, array, CPUPRI_NR_PRIORITIES) |
51 | idx < CPUPRI_NR_PRIORITIES; \ | ||
52 | idx = find_next_bit(array, CPUPRI_NR_PRIORITIES, idx+1)) | ||
53 | 51 | ||
54 | /** | 52 | /** |
55 | * cpupri_find - find the best (lowest-pri) CPU in the system | 53 | * cpupri_find - find the best (lowest-pri) CPU in the system |
@@ -135,26 +133,26 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri) | |||
135 | if (likely(newpri != CPUPRI_INVALID)) { | 133 | if (likely(newpri != CPUPRI_INVALID)) { |
136 | struct cpupri_vec *vec = &cp->pri_to_cpu[newpri]; | 134 | struct cpupri_vec *vec = &cp->pri_to_cpu[newpri]; |
137 | 135 | ||
138 | spin_lock_irqsave(&vec->lock, flags); | 136 | raw_spin_lock_irqsave(&vec->lock, flags); |
139 | 137 | ||
140 | cpumask_set_cpu(cpu, vec->mask); | 138 | cpumask_set_cpu(cpu, vec->mask); |
141 | vec->count++; | 139 | vec->count++; |
142 | if (vec->count == 1) | 140 | if (vec->count == 1) |
143 | set_bit(newpri, cp->pri_active); | 141 | set_bit(newpri, cp->pri_active); |
144 | 142 | ||
145 | spin_unlock_irqrestore(&vec->lock, flags); | 143 | raw_spin_unlock_irqrestore(&vec->lock, flags); |
146 | } | 144 | } |
147 | if (likely(oldpri != CPUPRI_INVALID)) { | 145 | if (likely(oldpri != CPUPRI_INVALID)) { |
148 | struct cpupri_vec *vec = &cp->pri_to_cpu[oldpri]; | 146 | struct cpupri_vec *vec = &cp->pri_to_cpu[oldpri]; |
149 | 147 | ||
150 | spin_lock_irqsave(&vec->lock, flags); | 148 | raw_spin_lock_irqsave(&vec->lock, flags); |
151 | 149 | ||
152 | vec->count--; | 150 | vec->count--; |
153 | if (!vec->count) | 151 | if (!vec->count) |
154 | clear_bit(oldpri, cp->pri_active); | 152 | clear_bit(oldpri, cp->pri_active); |
155 | cpumask_clear_cpu(cpu, vec->mask); | 153 | cpumask_clear_cpu(cpu, vec->mask); |
156 | 154 | ||
157 | spin_unlock_irqrestore(&vec->lock, flags); | 155 | raw_spin_unlock_irqrestore(&vec->lock, flags); |
158 | } | 156 | } |
159 | 157 | ||
160 | *currpri = newpri; | 158 | *currpri = newpri; |
@@ -180,7 +178,7 @@ int cpupri_init(struct cpupri *cp, bool bootmem) | |||
180 | for (i = 0; i < CPUPRI_NR_PRIORITIES; i++) { | 178 | for (i = 0; i < CPUPRI_NR_PRIORITIES; i++) { |
181 | struct cpupri_vec *vec = &cp->pri_to_cpu[i]; | 179 | struct cpupri_vec *vec = &cp->pri_to_cpu[i]; |
182 | 180 | ||
183 | spin_lock_init(&vec->lock); | 181 | raw_spin_lock_init(&vec->lock); |
184 | vec->count = 0; | 182 | vec->count = 0; |
185 | if (!zalloc_cpumask_var(&vec->mask, gfp)) | 183 | if (!zalloc_cpumask_var(&vec->mask, gfp)) |
186 | goto cleanup; | 184 | goto cleanup; |