mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: jgarzik@pobox.com, torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] workqueue.c neatening II
Date: Mon, 23 Jun 2003 13:20:25 +1000	[thread overview]
Message-ID: <20030623032108.925012C003@lists.samba.org> (raw)

Linus applied my patch before Jeff's critique.  Here's the fix.

Linus, please apply.
Rusty.

Name: Workqueue Exit Neatening
Author: Rusty Russell
Status: Tested on 2.5.73

D: Jeff Garzik points out the initializing the exit completion at
D: exit time is foolish: we should just initialize it at creation time
D: live everything else in that structure, and avoid the memory barrier.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22396-linux-2.5.73/kernel/workqueue.c .22396-linux-2.5.73.updated/kernel/workqueue.c
--- .22396-linux-2.5.73/kernel/workqueue.c	2003-06-23 10:52:59.000000000 +1000
+++ .22396-linux-2.5.73.updated/kernel/workqueue.c	2003-06-23 12:01:18.000000000 +1000
@@ -275,6 +275,7 @@ static int create_workqueue_thread(struc
 	INIT_LIST_HEAD(&cwq->worklist);
 	init_waitqueue_head(&cwq->more_work);
 	init_waitqueue_head(&cwq->work_done);
+	init_completion(&cwq->exit);
 
 	init_completion(&startup.done);
 	startup.cwq = cwq;
@@ -320,10 +321,7 @@ static void cleanup_workqueue_thread(str
 
 	cwq = wq->cpu_wq + cpu;
 	if (cwq->thread) {
-		printk("Cleaning up workqueue thread for %i\n", cpu);
-		/* Initiate an exit and wait for it: */
-		init_completion(&cwq->exit);
-		wmb(); /* Thread must see !cwq->thread after completion init */
+		/* Tell thread to exit and wait for it. */
 		cwq->thread = NULL;
 		wake_up(&cwq->more_work);
 

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

                 reply	other threads:[~2003-06-23  3:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20030623032108.925012C003@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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®