Re: [PATCH] padata: Replace delayed timer with immediate workqueue in padata_reorder

From: Herbert Xu
Date: Wed Jul 17 2019 - 23:30:33 EST


On Wed, Jul 17, 2019 at 07:21:36PM -0400, Daniel Jordan wrote:
>
> > @@ -388,12 +336,12 @@ void padata_do_serial(struct padata_priv *padata)
> > pqueue = per_cpu_ptr(pd->pqueue, cpu);
> >
> > spin_lock(&pqueue->reorder.lock);
> > - atomic_inc(&pd->reorder_objects);
> > list_add_tail(&padata->list, &pqueue->reorder.list);
> > + atomic_inc(&pd->reorder_objects);
>
> Why switch the lines? Seems ok to not do this.

This is crucial because otherwise the memory barrier won't apply
to the list insertion. With this patch, we are now using the list
insertion as the indicator, rather than reorder_objects.

> > @@ -538,8 +479,6 @@ static void padata_flush_queues(struct parallel_data *pd)
> > flush_work(&pqueue->work);
> > }
> >
> > - del_timer_sync(&pd->timer);
> > -
>
> > if (atomic_read(&pd->reorder_objects))
> > padata_reorder(pd);
>
> I think we can do away with reorder_objects entirely by checking pd->cpu's
> reorder queue here.

As I said this will probably disappear altogether since we can't
guarantee that padata_reorder will actually do anything if the
jobs are stuck in async crypto processing.

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