Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29707
b: refs/heads/master
c: b613677
h: refs/heads/master
i:
  29705: bcc663d
  29703: ff7bce4
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Jun 25, 2006
1 parent dd7ac33 commit b5d013f
Show file tree
Hide file tree
Showing 2 changed files with 21 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: 232acbcf5304c29f5bb03b0dddeaefd0f98ef45e
refs/heads/master: b61367732fc273977cc3fb85c272ce1a7bb1f533
28 changes: 20 additions & 8 deletions trunk/kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,22 +428,34 @@ int schedule_delayed_work_on(int cpu,
return ret;
}

int schedule_on_each_cpu(void (*func) (void *info), void *info)
/**
* schedule_on_each_cpu - call a function on each online CPU from keventd
* @func: the function to call
* @info: a pointer to pass to func()
*
* Returns zero on success.
* Returns -ve errno on failure.
*
* Appears to be racy against CPU hotplug.
*
* schedule_on_each_cpu() is very slow.
*/
int schedule_on_each_cpu(void (*func)(void *info), void *info)
{
int cpu;
struct work_struct *work;
struct work_struct *works;

work = kmalloc(NR_CPUS * sizeof(struct work_struct), GFP_KERNEL);

if (!work)
works = alloc_percpu(struct work_struct);
if (!works)
return -ENOMEM;

for_each_online_cpu(cpu) {
INIT_WORK(work + cpu, func, info);
INIT_WORK(per_cpu_ptr(works, cpu), func, info);
__queue_work(per_cpu_ptr(keventd_wq->cpu_wq, cpu),
work + cpu);
per_cpu_ptr(works, cpu));
}
flush_workqueue(keventd_wq);
kfree(work);
free_percpu(works);
return 0;
}

Expand Down

0 comments on commit b5d013f

Please sign in to comment.