lkml.org 
[lkml]   [2019]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/5] padata: make flushing work with async users
On Wed, Aug 28, 2019 at 06:14:21PM -0400, Daniel Jordan wrote:
>
> @@ -453,24 +456,15 @@ static void padata_free_pd(struct parallel_data *pd)
> /* Flush all objects out of the padata queues. */
> static void padata_flush_queues(struct parallel_data *pd)
> {
> - int cpu;
> - struct padata_parallel_queue *pqueue;
> - struct padata_serial_queue *squeue;
> -
> - for_each_cpu(cpu, pd->cpumask.pcpu) {
> - pqueue = per_cpu_ptr(pd->pqueue, cpu);
> - flush_work(&pqueue->work);
> - }
> -
> - if (atomic_read(&pd->reorder_objects))
> - padata_reorder(pd);
> + if (!(pd->pinst->flags & PADATA_INIT))
> + return;
>
> - for_each_cpu(cpu, pd->cpumask.cbcpu) {
> - squeue = per_cpu_ptr(pd->squeue, cpu);
> - flush_work(&squeue->work);
> - }
> + if (atomic_dec_return(&pd->refcnt) == 0)
> + complete(&pd->flushing_done);
>
> - BUG_ON(atomic_read(&pd->refcnt) != 0);
> + wait_for_completion(&pd->flushing_done);
> + reinit_completion(&pd->flushing_done);
> + atomic_set(&pd->refcnt, 1);
> }

I don't think waiting is an option. In a pathological case the
hardware may not return at all. We cannot and should not hold off
CPU hotplug for an arbitrary amount of time when the event we are
waiting for isn't even occuring on that CPU.

I don't think flushing is needed at all. All we need to do is
maintain consistency before and after the CPU hotplug event.

Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

\
 
 \ /
  Last update: 2019-09-05 06:18    [W:0.124 / U:1.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site