mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Anil" <anil.s.keshavamurthy@intel.com>
To: <linux-kernel@vger.kernel.org>, "Andrew Morton" <akpm@osdl.org>
Subject: [PATCH] speedup flush_workqueue for singlethread_workqueue
Date: Fri, 4 Jun 2004 15:13:34 -0700	[thread overview]
Message-ID: <ORSMSX409uejPw8Zyai00000001@orsmsx409.amr.corp.intel.com> (raw)

	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) {

_





             reply	other threads:[~2004-06-04 22:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-04 22:13 Anil [this message]
2004-06-04 22:30 ` Andrew Morton
2004-06-06  2:11   ` Rusty Russell
2004-06-07 17:46     ` Anil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ORSMSX409uejPw8Zyai00000001@orsmsx409.amr.corp.intel.com \
    --to=anil.s.keshavamurthy@intel.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®