• Home
  • Raw
  • Download

Lines Matching refs:pd

47 static void padata_free_pd(struct parallel_data *pd);
50 static int padata_index_to_cpu(struct parallel_data *pd, int cpu_index) in padata_index_to_cpu() argument
54 target_cpu = cpumask_first(pd->cpumask.pcpu); in padata_index_to_cpu()
56 target_cpu = cpumask_next(target_cpu, pd->cpumask.pcpu); in padata_index_to_cpu()
61 static int padata_cpu_hash(struct parallel_data *pd, unsigned int seq_nr) in padata_cpu_hash() argument
67 int cpu_index = seq_nr % cpumask_weight(pd->cpumask.pcpu); in padata_cpu_hash()
69 return padata_index_to_cpu(pd, cpu_index); in padata_cpu_hash()
172 struct parallel_data *pd; in padata_do_parallel() local
177 pd = rcu_dereference_bh(ps->pd); in padata_do_parallel()
183 if (!cpumask_test_cpu(*cb_cpu, pd->cpumask.cbcpu)) { in padata_do_parallel()
184 if (cpumask_empty(pd->cpumask.cbcpu)) in padata_do_parallel()
188 cpu_index = *cb_cpu % cpumask_weight(pd->cpumask.cbcpu); in padata_do_parallel()
190 cpu = cpumask_first(pd->cpumask.cbcpu); in padata_do_parallel()
192 cpu = cpumask_next(cpu, pd->cpumask.cbcpu); in padata_do_parallel()
201 refcount_inc(&pd->refcnt); in padata_do_parallel()
202 padata->pd = pd; in padata_do_parallel()
206 padata->seq_nr = ++pd->seq_nr; in padata_do_parallel()
240 static struct padata_priv *padata_find_next(struct parallel_data *pd, in padata_find_next() argument
245 int cpu = pd->cpu; in padata_find_next()
247 reorder = per_cpu_ptr(pd->reorder_list, cpu); in padata_find_next()
261 if (padata->seq_nr != pd->processed) { in padata_find_next()
268 ++pd->processed; in padata_find_next()
269 pd->cpu = cpumask_next_wrap(cpu, pd->cpumask.pcpu, -1, false); in padata_find_next()
276 static void padata_reorder(struct parallel_data *pd) in padata_reorder() argument
278 struct padata_instance *pinst = pd->ps->pinst; in padata_reorder()
294 if (!spin_trylock_bh(&pd->lock)) in padata_reorder()
298 padata = padata_find_next(pd, true); in padata_reorder()
309 squeue = per_cpu_ptr(pd->squeue, cb_cpu); in padata_reorder()
318 spin_unlock_bh(&pd->lock); in padata_reorder()
330 reorder = per_cpu_ptr(pd->reorder_list, pd->cpu); in padata_reorder()
331 if (!list_empty(&reorder->list) && padata_find_next(pd, false)) in padata_reorder()
332 queue_work(pinst->serial_wq, &pd->reorder_work); in padata_reorder()
337 struct parallel_data *pd; in invoke_padata_reorder() local
340 pd = container_of(work, struct parallel_data, reorder_work); in invoke_padata_reorder()
341 padata_reorder(pd); in invoke_padata_reorder()
348 struct parallel_data *pd; in padata_serial_worker() local
354 pd = squeue->pd; in padata_serial_worker()
375 if (refcount_sub_and_test(cnt, &pd->refcnt)) in padata_serial_worker()
376 padata_free_pd(pd); in padata_serial_worker()
389 struct parallel_data *pd = padata->pd; in padata_do_serial() local
390 int hashed_cpu = padata_cpu_hash(pd, padata->seq_nr); in padata_do_serial()
391 struct padata_list *reorder = per_cpu_ptr(pd->reorder_list, hashed_cpu); in padata_do_serial()
412 padata_reorder(pd); in padata_do_serial()
532 static void padata_init_squeues(struct parallel_data *pd) in padata_init_squeues() argument
537 for_each_cpu(cpu, pd->cpumask.cbcpu) { in padata_init_squeues()
538 squeue = per_cpu_ptr(pd->squeue, cpu); in padata_init_squeues()
539 squeue->pd = pd; in padata_init_squeues()
546 static void padata_init_reorder_list(struct parallel_data *pd) in padata_init_reorder_list() argument
551 for_each_cpu(cpu, pd->cpumask.pcpu) { in padata_init_reorder_list()
552 list = per_cpu_ptr(pd->reorder_list, cpu); in padata_init_reorder_list()
561 struct parallel_data *pd; in padata_alloc_pd() local
563 pd = kzalloc(sizeof(struct parallel_data), GFP_KERNEL); in padata_alloc_pd()
564 if (!pd) in padata_alloc_pd()
567 pd->reorder_list = alloc_percpu(struct padata_list); in padata_alloc_pd()
568 if (!pd->reorder_list) in padata_alloc_pd()
571 pd->squeue = alloc_percpu(struct padata_serial_queue); in padata_alloc_pd()
572 if (!pd->squeue) in padata_alloc_pd()
575 pd->ps = ps; in padata_alloc_pd()
577 if (!alloc_cpumask_var(&pd->cpumask.pcpu, GFP_KERNEL)) in padata_alloc_pd()
579 if (!alloc_cpumask_var(&pd->cpumask.cbcpu, GFP_KERNEL)) in padata_alloc_pd()
582 cpumask_and(pd->cpumask.pcpu, pinst->cpumask.pcpu, cpu_online_mask); in padata_alloc_pd()
583 cpumask_and(pd->cpumask.cbcpu, pinst->cpumask.cbcpu, cpu_online_mask); in padata_alloc_pd()
585 padata_init_reorder_list(pd); in padata_alloc_pd()
586 padata_init_squeues(pd); in padata_alloc_pd()
587 pd->seq_nr = -1; in padata_alloc_pd()
588 refcount_set(&pd->refcnt, 1); in padata_alloc_pd()
589 spin_lock_init(&pd->lock); in padata_alloc_pd()
590 pd->cpu = cpumask_first(pd->cpumask.pcpu); in padata_alloc_pd()
591 INIT_WORK(&pd->reorder_work, invoke_padata_reorder); in padata_alloc_pd()
593 return pd; in padata_alloc_pd()
596 free_cpumask_var(pd->cpumask.pcpu); in padata_alloc_pd()
598 free_percpu(pd->squeue); in padata_alloc_pd()
600 free_percpu(pd->reorder_list); in padata_alloc_pd()
602 kfree(pd); in padata_alloc_pd()
607 static void padata_free_pd(struct parallel_data *pd) in padata_free_pd() argument
609 free_cpumask_var(pd->cpumask.pcpu); in padata_free_pd()
610 free_cpumask_var(pd->cpumask.cbcpu); in padata_free_pd()
611 free_percpu(pd->reorder_list); in padata_free_pd()
612 free_percpu(pd->squeue); in padata_free_pd()
613 kfree(pd); in padata_free_pd()
640 ps->opd = rcu_dereference_protected(ps->pd, 1); in padata_replace_one()
641 rcu_assign_pointer(ps->pd, pd_new); in padata_replace_one()
1060 struct parallel_data *pd; in padata_alloc_shell() local
1070 pd = padata_alloc_pd(ps); in padata_alloc_shell()
1073 if (!pd) in padata_alloc_shell()
1077 RCU_INIT_POINTER(ps->pd, pd); in padata_alloc_shell()
1097 struct parallel_data *pd; in padata_free_shell() local
1104 pd = rcu_dereference_protected(ps->pd, 1); in padata_free_shell()
1105 if (refcount_dec_and_test(&pd->refcnt)) in padata_free_shell()
1106 padata_free_pd(pd); in padata_free_shell()