Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 168704
b: refs/heads/master
c: 9398180
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Linus Torvalds committed Nov 18, 2009
1 parent 98fbea8 commit c418915
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 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: e13193319d3a5545c82ed4b724bffd16f87873e3
refs/heads/master: 9398180097e359646d46083c3e079a54e20bee82
28 changes: 13 additions & 15 deletions trunk/kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,31 +692,29 @@ int schedule_on_each_cpu(work_func_t func)
if (!works)
return -ENOMEM;

get_online_cpus();

/*
* when running in keventd don't schedule a work item on itself.
* Can just call directly because the work queue is already bound.
* This also is faster.
* Make this a generic parameter for other workqueues?
* When running in keventd don't schedule a work item on
* itself. Can just call directly because the work queue is
* already bound. This also is faster.
*/
if (current_is_keventd()) {
if (current_is_keventd())
orig = raw_smp_processor_id();
INIT_WORK(per_cpu_ptr(works, orig), func);
func(per_cpu_ptr(works, orig));
}

get_online_cpus();
for_each_online_cpu(cpu) {
struct work_struct *work = per_cpu_ptr(works, cpu);

if (cpu == orig)
continue;
INIT_WORK(work, func);
schedule_work_on(cpu, work);
}
for_each_online_cpu(cpu) {
if (cpu != orig)
flush_work(per_cpu_ptr(works, cpu));
schedule_work_on(cpu, work);
}
if (orig >= 0)
func(per_cpu_ptr(works, orig));

for_each_online_cpu(cpu)
flush_work(per_cpu_ptr(works, cpu));

put_online_cpus();
free_percpu(works);
return 0;
Expand Down

0 comments on commit c418915

Please sign in to comment.