Commit f601c725 authored by Daniel Jordan's avatar Daniel Jordan Committed by Herbert Xu

padata: remove padata_parallel_queue

Only its reorder field is actually used now, so remove the struct and
embed @reorder directly in parallel_data.

No functional change, just a cleanup.
Signed-off-by: default avatarDaniel Jordan <daniel.m.jordan@oracle.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 3f257191
...@@ -66,17 +66,6 @@ struct padata_serial_queue { ...@@ -66,17 +66,6 @@ struct padata_serial_queue {
struct parallel_data *pd; struct parallel_data *pd;
}; };
/**
* struct padata_parallel_queue - The percpu padata parallel queue
*
* @reorder: List to wait for reordering after parallel processing.
* @num_obj: Number of objects that are processed by this cpu.
*/
struct padata_parallel_queue {
struct padata_list reorder;
atomic_t num_obj;
};
/** /**
* struct padata_cpumask - The cpumasks for the parallel/serial workers * struct padata_cpumask - The cpumasks for the parallel/serial workers
* *
...@@ -93,7 +82,7 @@ struct padata_cpumask { ...@@ -93,7 +82,7 @@ struct padata_cpumask {
* that depends on the cpumask in use. * that depends on the cpumask in use.
* *
* @ps: padata_shell object. * @ps: padata_shell object.
* @pqueue: percpu padata queues used for parallelization. * @reorder_list: percpu reorder lists
* @squeue: percpu padata queues used for serialuzation. * @squeue: percpu padata queues used for serialuzation.
* @refcnt: Number of objects holding a reference on this parallel_data. * @refcnt: Number of objects holding a reference on this parallel_data.
* @seq_nr: Sequence number of the parallelized data object. * @seq_nr: Sequence number of the parallelized data object.
...@@ -105,7 +94,7 @@ struct padata_cpumask { ...@@ -105,7 +94,7 @@ struct padata_cpumask {
*/ */
struct parallel_data { struct parallel_data {
struct padata_shell *ps; struct padata_shell *ps;
struct padata_parallel_queue __percpu *pqueue; struct padata_list __percpu *reorder_list;
struct padata_serial_queue __percpu *squeue; struct padata_serial_queue __percpu *squeue;
atomic_t refcnt; atomic_t refcnt;
unsigned int seq_nr; unsigned int seq_nr;
......
...@@ -250,13 +250,11 @@ EXPORT_SYMBOL(padata_do_parallel); ...@@ -250,13 +250,11 @@ EXPORT_SYMBOL(padata_do_parallel);
static struct padata_priv *padata_find_next(struct parallel_data *pd, static struct padata_priv *padata_find_next(struct parallel_data *pd,
bool remove_object) bool remove_object)
{ {
struct padata_parallel_queue *next_queue;
struct padata_priv *padata; struct padata_priv *padata;
struct padata_list *reorder; struct padata_list *reorder;
int cpu = pd->cpu; int cpu = pd->cpu;
next_queue = per_cpu_ptr(pd->pqueue, cpu); reorder = per_cpu_ptr(pd->reorder_list, cpu);
reorder = &next_queue->reorder;
spin_lock(&reorder->lock); spin_lock(&reorder->lock);
if (list_empty(&reorder->list)) { if (list_empty(&reorder->list)) {
...@@ -291,7 +289,7 @@ static void padata_reorder(struct parallel_data *pd) ...@@ -291,7 +289,7 @@ static void padata_reorder(struct parallel_data *pd)
int cb_cpu; int cb_cpu;
struct padata_priv *padata; struct padata_priv *padata;
struct padata_serial_queue *squeue; struct padata_serial_queue *squeue;
struct padata_parallel_queue *next_queue; struct padata_list *reorder;
/* /*
* We need to ensure that only one cpu can work on dequeueing of * We need to ensure that only one cpu can work on dequeueing of
...@@ -339,9 +337,8 @@ static void padata_reorder(struct parallel_data *pd) ...@@ -339,9 +337,8 @@ static void padata_reorder(struct parallel_data *pd)
*/ */
smp_mb(); smp_mb();
next_queue = per_cpu_ptr(pd->pqueue, pd->cpu); reorder = per_cpu_ptr(pd->reorder_list, pd->cpu);
if (!list_empty(&next_queue->reorder.list) && if (!list_empty(&reorder->list) && padata_find_next(pd, false))
padata_find_next(pd, false))
queue_work(pinst->serial_wq, &pd->reorder_work); queue_work(pinst->serial_wq, &pd->reorder_work);
} }
...@@ -401,17 +398,16 @@ void padata_do_serial(struct padata_priv *padata) ...@@ -401,17 +398,16 @@ void padata_do_serial(struct padata_priv *padata)
{ {
struct parallel_data *pd = padata->pd; struct parallel_data *pd = padata->pd;
int hashed_cpu = padata_cpu_hash(pd, padata->seq_nr); int hashed_cpu = padata_cpu_hash(pd, padata->seq_nr);
struct padata_parallel_queue *pqueue = per_cpu_ptr(pd->pqueue, struct padata_list *reorder = per_cpu_ptr(pd->reorder_list, hashed_cpu);
hashed_cpu);
struct padata_priv *cur; struct padata_priv *cur;
spin_lock(&pqueue->reorder.lock); spin_lock(&reorder->lock);
/* Sort in ascending order of sequence number. */ /* Sort in ascending order of sequence number. */
list_for_each_entry_reverse(cur, &pqueue->reorder.list, list) list_for_each_entry_reverse(cur, &reorder->list, list)
if (cur->seq_nr < padata->seq_nr) if (cur->seq_nr < padata->seq_nr)
break; break;
list_add(&padata->list, &cur->list); list_add(&padata->list, &cur->list);
spin_unlock(&pqueue->reorder.lock); spin_unlock(&reorder->lock);
/* /*
* Ensure the addition to the reorder list is ordered correctly * Ensure the addition to the reorder list is ordered correctly
...@@ -553,17 +549,15 @@ static void padata_init_squeues(struct parallel_data *pd) ...@@ -553,17 +549,15 @@ static void padata_init_squeues(struct parallel_data *pd)
} }
} }
/* Initialize all percpu queues used by parallel workers */ /* Initialize per-CPU reorder lists */
static void padata_init_pqueues(struct parallel_data *pd) static void padata_init_reorder_list(struct parallel_data *pd)
{ {
int cpu; int cpu;
struct padata_parallel_queue *pqueue; struct padata_list *list;
for_each_cpu(cpu, pd->cpumask.pcpu) { for_each_cpu(cpu, pd->cpumask.pcpu) {
pqueue = per_cpu_ptr(pd->pqueue, cpu); list = per_cpu_ptr(pd->reorder_list, cpu);
__padata_list_init(list);
__padata_list_init(&pqueue->reorder);
atomic_set(&pqueue->num_obj, 0);
} }
} }
...@@ -577,13 +571,13 @@ static struct parallel_data *padata_alloc_pd(struct padata_shell *ps) ...@@ -577,13 +571,13 @@ static struct parallel_data *padata_alloc_pd(struct padata_shell *ps)
if (!pd) if (!pd)
goto err; goto err;
pd->pqueue = alloc_percpu(struct padata_parallel_queue); pd->reorder_list = alloc_percpu(struct padata_list);
if (!pd->pqueue) if (!pd->reorder_list)
goto err_free_pd; goto err_free_pd;
pd->squeue = alloc_percpu(struct padata_serial_queue); pd->squeue = alloc_percpu(struct padata_serial_queue);
if (!pd->squeue) if (!pd->squeue)
goto err_free_pqueue; goto err_free_reorder_list;
pd->ps = ps; pd->ps = ps;
...@@ -595,7 +589,7 @@ static struct parallel_data *padata_alloc_pd(struct padata_shell *ps) ...@@ -595,7 +589,7 @@ static struct parallel_data *padata_alloc_pd(struct padata_shell *ps)
cpumask_and(pd->cpumask.pcpu, pinst->cpumask.pcpu, cpu_online_mask); cpumask_and(pd->cpumask.pcpu, pinst->cpumask.pcpu, cpu_online_mask);
cpumask_and(pd->cpumask.cbcpu, pinst->cpumask.cbcpu, cpu_online_mask); cpumask_and(pd->cpumask.cbcpu, pinst->cpumask.cbcpu, cpu_online_mask);
padata_init_pqueues(pd); padata_init_reorder_list(pd);
padata_init_squeues(pd); padata_init_squeues(pd);
pd->seq_nr = -1; pd->seq_nr = -1;
atomic_set(&pd->refcnt, 1); atomic_set(&pd->refcnt, 1);
...@@ -609,8 +603,8 @@ static struct parallel_data *padata_alloc_pd(struct padata_shell *ps) ...@@ -609,8 +603,8 @@ static struct parallel_data *padata_alloc_pd(struct padata_shell *ps)
free_cpumask_var(pd->cpumask.pcpu); free_cpumask_var(pd->cpumask.pcpu);
err_free_squeue: err_free_squeue:
free_percpu(pd->squeue); free_percpu(pd->squeue);
err_free_pqueue: err_free_reorder_list:
free_percpu(pd->pqueue); free_percpu(pd->reorder_list);
err_free_pd: err_free_pd:
kfree(pd); kfree(pd);
err: err:
...@@ -621,7 +615,7 @@ static void padata_free_pd(struct parallel_data *pd) ...@@ -621,7 +615,7 @@ static void padata_free_pd(struct parallel_data *pd)
{ {
free_cpumask_var(pd->cpumask.pcpu); free_cpumask_var(pd->cpumask.pcpu);
free_cpumask_var(pd->cpumask.cbcpu); free_cpumask_var(pd->cpumask.cbcpu);
free_percpu(pd->pqueue); free_percpu(pd->reorder_list);
free_percpu(pd->squeue); free_percpu(pd->squeue);
kfree(pd); kfree(pd);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment