[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aCRoStLRAibD-Jak@gondor.apana.org.au>
Date: Wed, 14 May 2025 17:54:18 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Yury Norov <yury.norov@...il.com>
Cc: Kristen Accardi <kristen.c.accardi@...el.com>,
Vinicius Costa Gomes <vinicius.gomes@...el.com>,
"David S. Miller" <davem@...emloft.net>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: iaa - Optimize rebalance_wq_table()
On Thu, May 08, 2025 at 03:59:50PM -0400, Yury Norov wrote:
> The function opencodes for_each_cpu() by using a plain for-loop. The
> loop calls cpumask_weight() inside the conditional section. Because
> cpumask_weight() is O(1), the overall complexity of the function is
> O(node * node_cpus^2). Also, cpumask_nth() internally calls hweight(),
> which, if not hardware accelerated, is slower than cpumask_next() in
> for_each_cpu().
>
> If switched to the dedicated for_each_cpu(), the rebalance_wq_table()
> can drop calling cpumask_weight(), together with some housekeeping code.
> This makes the overall complexity O(node * node_cpus), or simply speaking
> O(nr_cpu_ids).
>
> While there, fix opencoded for_each_possible_cpu() too.
>
> Signed-off-by: Yury Norov <yury.norov@...il.com>
> ---
> drivers/crypto/intel/iaa/iaa_crypto_main.c | 35 +++++++++-------------
> 1 file changed, 14 insertions(+), 21 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists