Messages in this thread Patch in this message | | | From | "Anil" <> | Subject | [PATCH] speedup flush_workqueue for singlethread_workqueue | Date | Fri, 4 Jun 2004 15:13:34 -0700 |
| |
In the flush_workqueue function for a single_threaded_worqueue case the code seemed to loop the same cpu_workqueue_struct for each_online_cpu's. The attached patch checks this condition and bails out of for loop there by speeding up the flush_workqueue for a singlethreaded_workqueue.
Please apply.
Thanks, -anil
---
Name: speedup_flush_workqueue_for_single_thread Status: Test Passed
linux-2.6.7-rc2-mm2-root/kernel/workqueue.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
diff -puN kernel/workqueue.c~flush_work_queue_fix kernel/workqueue.c --- linux-2.6.7-rc2-mm2/kernel/workqueue.c~flush_work_queue_fix 2004-06-04 21:38:49.848195790 -0700 +++ linux-2.6.7-rc2-mm2-root/kernel/workqueue.c 2004-06-04 21:42:50.013357817 -0700 @@ -236,6 +236,7 @@ void fastcall flush_workqueue(struct wor { struct cpu_workqueue_struct *cwq; int cpu; + int run_once = 0; might_sleep(); @@ -244,9 +245,12 @@ void fastcall flush_workqueue(struct wor DEFINE_WAIT(wait); long sequence_needed; - if (is_single_threaded(wq)) + if (is_single_threaded(wq)) { + if (run_once) + break; cwq = wq->cpu_wq + 0; /* Always use cpu 0's area. */ - else + run_once = 1; + } else cwq = wq->cpu_wq + cpu; if (cwq->thread == current) { _
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |