diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-12-03 07:49:39 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-12-03 07:49:39 -0500 |
commit | 220d0b1dbf78c6417a658c96e571415552d3abac (patch) | |
tree | 70cd3862540c38ea490e7a27c3c7acc35b680234 /kernel/workqueue.c | |
parent | 474b18ccc264c472abeec50f48469b6477202699 (diff) | |
parent | 22763c5cf3690a681551162c15d34d935308c8d7 (diff) |
Merge branch 'master' into for-2.6.33
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 12328147132c..67e526b6ae81 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -692,31 +692,29 @@ int schedule_on_each_cpu(work_func_t func) | |||
692 | if (!works) | 692 | if (!works) |
693 | return -ENOMEM; | 693 | return -ENOMEM; |
694 | 694 | ||
695 | get_online_cpus(); | ||
696 | |||
695 | /* | 697 | /* |
696 | * when running in keventd don't schedule a work item on itself. | 698 | * When running in keventd don't schedule a work item on |
697 | * Can just call directly because the work queue is already bound. | 699 | * itself. Can just call directly because the work queue is |
698 | * This also is faster. | 700 | * already bound. This also is faster. |
699 | * Make this a generic parameter for other workqueues? | ||
700 | */ | 701 | */ |
701 | if (current_is_keventd()) { | 702 | if (current_is_keventd()) |
702 | orig = raw_smp_processor_id(); | 703 | orig = raw_smp_processor_id(); |
703 | INIT_WORK(per_cpu_ptr(works, orig), func); | ||
704 | func(per_cpu_ptr(works, orig)); | ||
705 | } | ||
706 | 704 | ||
707 | get_online_cpus(); | ||
708 | for_each_online_cpu(cpu) { | 705 | for_each_online_cpu(cpu) { |
709 | struct work_struct *work = per_cpu_ptr(works, cpu); | 706 | struct work_struct *work = per_cpu_ptr(works, cpu); |
710 | 707 | ||
711 | if (cpu == orig) | ||
712 | continue; | ||
713 | INIT_WORK(work, func); | 708 | INIT_WORK(work, func); |
714 | schedule_work_on(cpu, work); | ||
715 | } | ||
716 | for_each_online_cpu(cpu) { | ||
717 | if (cpu != orig) | 709 | if (cpu != orig) |
718 | flush_work(per_cpu_ptr(works, cpu)); | 710 | schedule_work_on(cpu, work); |
719 | } | 711 | } |
712 | if (orig >= 0) | ||
713 | func(per_cpu_ptr(works, orig)); | ||
714 | |||
715 | for_each_online_cpu(cpu) | ||
716 | flush_work(per_cpu_ptr(works, cpu)); | ||
717 | |||
720 | put_online_cpus(); | 718 | put_online_cpus(); |
721 | free_percpu(works); | 719 | free_percpu(works); |
722 | return 0; | 720 | return 0; |