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.

crypto: pcrypt - Optimize pcrypt_aead_init_tfm()

The function opencodes cpumask_nth(). The dedicated helper is faster
than an open for-loop.

Signed-off-by: Yury Norov [NVIDIA] <yury.norov@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Yury Norov [NVIDIA] and committed by
Herbert Xu
ea87e6c4 254923ca

+2 -5
+2 -5
crypto/pcrypt.c
··· 178 178 179 179 static int pcrypt_aead_init_tfm(struct crypto_aead *tfm) 180 180 { 181 - int cpu, cpu_index; 181 + int cpu_index; 182 182 struct aead_instance *inst = aead_alg_instance(tfm); 183 183 struct pcrypt_instance_ctx *ictx = aead_instance_ctx(inst); 184 184 struct pcrypt_aead_ctx *ctx = crypto_aead_ctx(tfm); ··· 187 187 cpu_index = (unsigned int)atomic_inc_return(&ictx->tfm_count) % 188 188 cpumask_weight(cpu_online_mask); 189 189 190 - ctx->cb_cpu = cpumask_first(cpu_online_mask); 191 - for (cpu = 0; cpu < cpu_index; cpu++) 192 - ctx->cb_cpu = cpumask_next(ctx->cb_cpu, cpu_online_mask); 193 - 190 + ctx->cb_cpu = cpumask_nth(cpu_index, cpu_online_mask); 194 191 cipher = crypto_spawn_aead(&ictx->spawn); 195 192 196 193 if (IS_ERR(cipher))