diff options
author | Anthony Yznaga <anthony.yznaga@oracle.com> | 2023-02-23 03:33:12 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2023-03-14 12:06:44 +0300 |
commit | f84155ca851849e5e8981fddd3945a6cfeea220c (patch) | |
tree | c7d55b635867808a7efb12f0dac98d8a6906d443 /kernel/padata.c | |
parent | 1e6204451fb8b14356d8a4c7fd692318edd4a99a (diff) | |
download | linux-f84155ca851849e5e8981fddd3945a6cfeea220c.tar.xz |
padata: use alignment when calculating the number of worker threads
For multithreaded jobs the computed chunk size is rounded up by the
caller-specified alignment. However, the number of worker threads to
use is computed using the minimum chunk size without taking alignment
into account. A sufficiently large alignment value can result in too
many worker threads being allocated for the job.
Signed-off-by: Anthony Yznaga <anthony.yznaga@oracle.com>
Acked-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'kernel/padata.c')
-rw-r--r-- | kernel/padata.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/padata.c b/kernel/padata.c index 106d08ee9ce2..222d60195de6 100644 --- a/kernel/padata.c +++ b/kernel/padata.c @@ -491,7 +491,7 @@ void __init padata_do_multithreaded(struct padata_mt_job *job) return; /* Ensure at least one thread when size < min_chunk. */ - nworks = max(job->size / job->min_chunk, 1ul); + nworks = max(job->size / max(job->min_chunk, job->align), 1ul); nworks = min(nworks, job->max_threads); if (nworks == 1) { |