diff options
author | Mathias Krause <minipli@googlemail.com> | 2017-09-08 14:57:09 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-10-07 00:10:31 -0400 |
commit | 1bd845bcb41d5b7f83745e0cb99273eb376f2ec5 (patch) | |
tree | f0f49135d882c6c0d3313587eaf657d7fc926c54 /kernel/padata.c | |
parent | 5e1a646204deb0efd0e0bbc1730ac11dcb39f8fb (diff) |
padata: set cpu_index of unused CPUs to -1
The parallel queue per-cpu data structure gets initialized only for CPUs
in the 'pcpu' CPU mask set. This is not sufficient as the reorder timer
may run on a different CPU and might wrongly decide it's the target CPU
for the next reorder item as per-cpu memory gets memset(0) and we might
be waiting for the first CPU in cpumask.pcpu, i.e. cpu_index 0.
Make the '__this_cpu_read(pd->pqueue->cpu_index) == next_queue->cpu_index'
compare in padata_get_next() fail in this case by initializing the
cpu_index member of all per-cpu parallel queues. Use -1 for unused ones.
Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'kernel/padata.c')
-rw-r--r-- | kernel/padata.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/padata.c b/kernel/padata.c index 868f947166d7..1b9b4bac4a9b 100644 --- a/kernel/padata.c +++ b/kernel/padata.c | |||
@@ -384,8 +384,14 @@ static void padata_init_pqueues(struct parallel_data *pd) | |||
384 | struct padata_parallel_queue *pqueue; | 384 | struct padata_parallel_queue *pqueue; |
385 | 385 | ||
386 | cpu_index = 0; | 386 | cpu_index = 0; |
387 | for_each_cpu(cpu, pd->cpumask.pcpu) { | 387 | for_each_possible_cpu(cpu) { |
388 | pqueue = per_cpu_ptr(pd->pqueue, cpu); | 388 | pqueue = per_cpu_ptr(pd->pqueue, cpu); |
389 | |||
390 | if (!cpumask_test_cpu(cpu, pd->cpumask.pcpu)) { | ||
391 | pqueue->cpu_index = -1; | ||
392 | continue; | ||
393 | } | ||
394 | |||
389 | pqueue->pd = pd; | 395 | pqueue->pd = pd; |
390 | pqueue->cpu_index = cpu_index; | 396 | pqueue->cpu_index = cpu_index; |
391 | cpu_index++; | 397 | cpu_index++; |