Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

objpool: rework objpool_pop()

The function has to track number of iterations to prevent an infinite
loop. for_each_cpu_wrap() macro takes care of it, which simplifies user
code.

Signed-off-by: Yury Norov <yury.norov@gmail.com>

+3 -4
+3 -4
include/linux/objpool.h
··· 170 170 { 171 171 void *obj = NULL; 172 172 unsigned long flags; 173 - int i, cpu; 173 + int start, cpu; 174 174 175 175 /* disable local irq to avoid preemption & interruption */ 176 176 raw_local_irq_save(flags); 177 177 178 - cpu = raw_smp_processor_id(); 179 - for (i = 0; i < pool->nr_possible_cpus; i++) { 178 + start = raw_smp_processor_id(); 179 + for_each_possible_cpu_wrap(cpu, start) { 180 180 obj = __objpool_try_get_slot(pool, cpu); 181 181 if (obj) 182 182 break; 183 - cpu = cpumask_next_wrap(cpu, cpu_possible_mask, -1, 1); 184 183 } 185 184 raw_local_irq_restore(flags); 186 185