Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 196731
b: refs/heads/master
c: 2b73b07
h: refs/heads/master
i:
  196729: b29795c
  196727: dc50b25
v: v3
  • Loading branch information
Steffen Klassert authored and Herbert Xu committed May 19, 2010
1 parent 75b90ec commit c0bc445
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d46a5ac7a7e2045e33c6ad6ffb8cf18a7e86a15a
refs/heads/master: 2b73b07ab8a44ce171e07a328439f311481a7ea7
33 changes: 25 additions & 8 deletions trunk/kernel/padata.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,29 @@ static void padata_free_pd(struct parallel_data *pd)
kfree(pd);
}

static void padata_flush_queues(struct parallel_data *pd)
{
int cpu;
struct padata_queue *queue;

for_each_cpu(cpu, pd->cpumask) {
queue = per_cpu_ptr(pd->queue, cpu);
flush_work(&queue->pwork);
}

del_timer_sync(&pd->timer);

if (atomic_read(&pd->reorder_objects))
padata_reorder(pd);

for_each_cpu(cpu, pd->cpumask) {
queue = per_cpu_ptr(pd->queue, cpu);
flush_work(&queue->swork);
}

BUG_ON(atomic_read(&pd->refcnt) != 0);
}

static void padata_replace(struct padata_instance *pinst,
struct parallel_data *pd_new)
{
Expand All @@ -428,11 +451,7 @@ static void padata_replace(struct padata_instance *pinst,

synchronize_rcu();

while (atomic_read(&pd_old->refcnt) != 0)
yield();

flush_workqueue(pinst->wq);

padata_flush_queues(pd_old);
padata_free_pd(pd_old);

pinst->flags &= ~PADATA_RESET;
Expand Down Expand Up @@ -695,12 +714,10 @@ void padata_free(struct padata_instance *pinst)

synchronize_rcu();

while (atomic_read(&pinst->pd->refcnt) != 0)
yield();

#ifdef CONFIG_HOTPLUG_CPU
unregister_hotcpu_notifier(&pinst->cpu_notifier);
#endif
padata_flush_queues(pinst->pd);
padata_free_pd(pinst->pd);
free_cpumask_var(pinst->cpumask);
kfree(pinst);
Expand Down

0 comments on commit c0bc445

Please sign in to comment.