Commit 7b389b2cc539dc2dc60b049240942be54958c93a

Authored by Steffen Klassert
Committed by Herbert Xu
1 parent 7d0d2d385c

padata: Initialize the padata queues only for the used cpus

padata_alloc_pd set up queues for all possible cpus.
This patch changes this to set up the queues just for
the used cpus.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Showing 1 changed file with 5 additions and 9 deletions Side-by-side Diff

... ... @@ -358,17 +358,15 @@
358 358 if (!alloc_cpumask_var(&pd->cpumask, GFP_KERNEL))
359 359 goto err_free_queue;
360 360  
361   - for_each_possible_cpu(cpu) {
  361 + cpumask_and(pd->cpumask, cpumask, cpu_active_mask);
  362 +
  363 + for_each_cpu(cpu, pd->cpumask) {
362 364 queue = per_cpu_ptr(pd->queue, cpu);
363 365  
364 366 queue->pd = pd;
365 367  
366   - if (cpumask_test_cpu(cpu, cpumask)
367   - && cpumask_test_cpu(cpu, cpu_active_mask)) {
368   - queue->cpu_index = cpu_index;
369   - cpu_index++;
370   - } else
371   - queue->cpu_index = -1;
  368 + queue->cpu_index = cpu_index;
  369 + cpu_index++;
372 370  
373 371 INIT_LIST_HEAD(&queue->reorder.list);
374 372 INIT_LIST_HEAD(&queue->parallel.list);
... ... @@ -381,8 +379,6 @@
381 379 INIT_WORK(&queue->swork, padata_serial_worker);
382 380 atomic_set(&queue->num_obj, 0);
383 381 }
384   -
385   - cpumask_and(pd->cpumask, cpumask, cpu_active_mask);
386 382  
387 383 num_cpus = cpumask_weight(pd->cpumask);
388 384 pd->max_seq_nr = (MAX_SEQ_NR / num_cpus) * num_cpus - 1;