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

padata: remove effective cpumasks from the instance

A padata instance has effective cpumasks that store the user-supplied
masks ANDed with the online mask, but this middleman is unnecessary.
parallel_data keeps the same information around.  Removing this saves
text and code churn in future changes.
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 cec00e6e
...@@ -167,7 +167,6 @@ struct padata_mt_job { ...@@ -167,7 +167,6 @@ struct padata_mt_job {
* @serial_wq: The workqueue used for serial work. * @serial_wq: The workqueue used for serial work.
* @pslist: List of padata_shell objects attached to this instance. * @pslist: List of padata_shell objects attached to this instance.
* @cpumask: User supplied cpumasks for parallel and serial works. * @cpumask: User supplied cpumasks for parallel and serial works.
* @rcpumask: Actual cpumasks based on user cpumask and cpu_online_mask.
* @kobj: padata instance kernel object. * @kobj: padata instance kernel object.
* @lock: padata instance lock. * @lock: padata instance lock.
* @flags: padata flags. * @flags: padata flags.
...@@ -179,7 +178,6 @@ struct padata_instance { ...@@ -179,7 +178,6 @@ struct padata_instance {
struct workqueue_struct *serial_wq; struct workqueue_struct *serial_wq;
struct list_head pslist; struct list_head pslist;
struct padata_cpumask cpumask; struct padata_cpumask cpumask;
struct padata_cpumask rcpumask;
struct kobject kobj; struct kobject kobj;
struct mutex lock; struct mutex lock;
u8 flags; u8 flags;
......
...@@ -571,13 +571,8 @@ static void padata_init_pqueues(struct parallel_data *pd) ...@@ -571,13 +571,8 @@ static void padata_init_pqueues(struct parallel_data *pd)
static struct parallel_data *padata_alloc_pd(struct padata_shell *ps) static struct parallel_data *padata_alloc_pd(struct padata_shell *ps)
{ {
struct padata_instance *pinst = ps->pinst; struct padata_instance *pinst = ps->pinst;
const struct cpumask *cbcpumask;
const struct cpumask *pcpumask;
struct parallel_data *pd; struct parallel_data *pd;
cbcpumask = pinst->rcpumask.cbcpu;
pcpumask = pinst->rcpumask.pcpu;
pd = kzalloc(sizeof(struct parallel_data), GFP_KERNEL); pd = kzalloc(sizeof(struct parallel_data), GFP_KERNEL);
if (!pd) if (!pd)
goto err; goto err;
...@@ -597,8 +592,8 @@ static struct parallel_data *padata_alloc_pd(struct padata_shell *ps) ...@@ -597,8 +592,8 @@ static struct parallel_data *padata_alloc_pd(struct padata_shell *ps)
if (!alloc_cpumask_var(&pd->cpumask.cbcpu, GFP_KERNEL)) if (!alloc_cpumask_var(&pd->cpumask.cbcpu, GFP_KERNEL))
goto err_free_pcpu; goto err_free_pcpu;
cpumask_copy(pd->cpumask.pcpu, pcpumask); cpumask_and(pd->cpumask.pcpu, pinst->cpumask.pcpu, cpu_online_mask);
cpumask_copy(pd->cpumask.cbcpu, cbcpumask); cpumask_and(pd->cpumask.cbcpu, pinst->cpumask.cbcpu, cpu_online_mask);
padata_init_pqueues(pd); padata_init_pqueues(pd);
padata_init_squeues(pd); padata_init_squeues(pd);
...@@ -668,12 +663,6 @@ static int padata_replace(struct padata_instance *pinst) ...@@ -668,12 +663,6 @@ static int padata_replace(struct padata_instance *pinst)
pinst->flags |= PADATA_RESET; pinst->flags |= PADATA_RESET;
cpumask_and(pinst->rcpumask.pcpu, pinst->cpumask.pcpu,
cpu_online_mask);
cpumask_and(pinst->rcpumask.cbcpu, pinst->cpumask.cbcpu,
cpu_online_mask);
list_for_each_entry(ps, &pinst->pslist, list) { list_for_each_entry(ps, &pinst->pslist, list) {
err = padata_replace_one(ps); err = padata_replace_one(ps);
if (err) if (err)
...@@ -856,8 +845,6 @@ static void __padata_free(struct padata_instance *pinst) ...@@ -856,8 +845,6 @@ static void __padata_free(struct padata_instance *pinst)
WARN_ON(!list_empty(&pinst->pslist)); WARN_ON(!list_empty(&pinst->pslist));
free_cpumask_var(pinst->rcpumask.cbcpu);
free_cpumask_var(pinst->rcpumask.pcpu);
free_cpumask_var(pinst->cpumask.pcpu); free_cpumask_var(pinst->cpumask.pcpu);
free_cpumask_var(pinst->cpumask.cbcpu); free_cpumask_var(pinst->cpumask.cbcpu);
destroy_workqueue(pinst->serial_wq); destroy_workqueue(pinst->serial_wq);
...@@ -1033,20 +1020,13 @@ static struct padata_instance *padata_alloc(const char *name, ...@@ -1033,20 +1020,13 @@ static struct padata_instance *padata_alloc(const char *name,
!padata_validate_cpumask(pinst, cbcpumask)) !padata_validate_cpumask(pinst, cbcpumask))
goto err_free_masks; goto err_free_masks;
if (!alloc_cpumask_var(&pinst->rcpumask.pcpu, GFP_KERNEL))
goto err_free_masks;
if (!alloc_cpumask_var(&pinst->rcpumask.cbcpu, GFP_KERNEL))
goto err_free_rcpumask_pcpu;
INIT_LIST_HEAD(&pinst->pslist); INIT_LIST_HEAD(&pinst->pslist);
cpumask_copy(pinst->cpumask.pcpu, pcpumask); cpumask_copy(pinst->cpumask.pcpu, pcpumask);
cpumask_copy(pinst->cpumask.cbcpu, cbcpumask); cpumask_copy(pinst->cpumask.cbcpu, cbcpumask);
cpumask_and(pinst->rcpumask.pcpu, pcpumask, cpu_online_mask);
cpumask_and(pinst->rcpumask.cbcpu, cbcpumask, cpu_online_mask);
if (padata_setup_cpumasks(pinst)) if (padata_setup_cpumasks(pinst))
goto err_free_rcpumask_cbcpu; goto err_free_masks;
__padata_start(pinst); __padata_start(pinst);
...@@ -1064,10 +1044,6 @@ static struct padata_instance *padata_alloc(const char *name, ...@@ -1064,10 +1044,6 @@ static struct padata_instance *padata_alloc(const char *name,
return pinst; return pinst;
err_free_rcpumask_cbcpu:
free_cpumask_var(pinst->rcpumask.cbcpu);
err_free_rcpumask_pcpu:
free_cpumask_var(pinst->rcpumask.pcpu);
err_free_masks: err_free_masks:
free_cpumask_var(pinst->cpumask.pcpu); free_cpumask_var(pinst->cpumask.pcpu);
free_cpumask_var(pinst->cpumask.cbcpu); free_cpumask_var(pinst->cpumask.cbcpu);
......
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