Skip to content

Commit

Permalink
crypto: pcrypt - Use the online cpumask as the default
Browse files Browse the repository at this point in the history
We use the active cpumask to determine the superset of cpus
to use for parallelization. However, the active cpumask is
for internal usage of the scheduler and therefore not the
appropriate cpumask for these purposes. So use the online
cpumask instead.

Reported-by: Peter Zijlstra <[email protected]>
Signed-off-by: Steffen Klassert <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
klassert authored and herbertx committed Mar 29, 2012
1 parent 9612090 commit fbf0ca1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crypto/pcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ static int pcrypt_aead_init_tfm(struct crypto_tfm *tfm)

ictx->tfm_count++;

cpu_index = ictx->tfm_count % cpumask_weight(cpu_active_mask);
cpu_index = ictx->tfm_count % cpumask_weight(cpu_online_mask);

ctx->cb_cpu = cpumask_first(cpu_active_mask);
ctx->cb_cpu = cpumask_first(cpu_online_mask);
for (cpu = 0; cpu < cpu_index; cpu++)
ctx->cb_cpu = cpumask_next(ctx->cb_cpu, cpu_active_mask);
ctx->cb_cpu = cpumask_next(ctx->cb_cpu, cpu_online_mask);

cipher = crypto_spawn_aead(crypto_instance_ctx(inst));

Expand Down Expand Up @@ -472,7 +472,7 @@ static int pcrypt_init_padata(struct padata_pcrypt *pcrypt,
goto err_free_padata;
}

cpumask_and(mask->mask, cpu_possible_mask, cpu_active_mask);
cpumask_and(mask->mask, cpu_possible_mask, cpu_online_mask);
rcu_assign_pointer(pcrypt->cb_cpumask, mask);

pcrypt->nblock.notifier_call = pcrypt_cpumask_change_notify;
Expand Down

0 comments on commit fbf0ca1

Please sign in to comment.