Skip to contentSkip to conversation

wait_for_completion API extension addition

DISCUSSION Mike Waychison 3 participants 5 messages Jan 25, 2005

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Ingo,

I noticed that the wait_for_completion API extensions made it into mainline.

However, I posted that the patch in question is broken a while back:

http://marc.theaimsgroup.com/?l=linux-kernel&m=110131832828126&w=2

Can we fix this?

Thanks,

- --
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: The opinions expressed in this email are held by me, and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB9qqDdQs4kOxk3/MRAnKmAJ4oAfPDj7fQrljahvQKWsOMGq7F2wCcDyMI oLJAXgNbAyhJEC0DFfozn0M=
=dbKU
-----END PGP SIGNATURE-----

#1 lore raw
Quoted 5 lines · Mike Waychison

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Ingo,

Quoted 7 lines

I noticed that the wait_for_completion API extensions made it into mainline.

However, I posted that the patch in question is broken a while back:

http://marc.theaimsgroup.com/?l=linux-kernel&m=110131832828126&w=2

Can we fix this?

We reposted a fixed version. It should not be the one from October which made it upstream.

tglx

#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 11 lines · Thomas Gleixner
Quoted 9 lines · Mike Waychison

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Ingo,

I noticed that the wait_for_completion API extensions made it into mainline.

However, I posted that the patch in question is broken a while back:

Quoted 8 lines
Quoted 3 lines

http://marc.theaimsgroup.com/?l=linux-kernel&m=110131832828126&w=2

Can we fix this?

We reposted a fixed version. It should not be the one from October which made it upstream.

Well, according to linux.bkbits.net/linux-2.5, it appears to have gotten the broken version :(

- --
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: The opinions expressed in this email are held by me, and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB9q7odQs4kOxk3/MRAhUbAJ9jhpFbrpqi2K+lakwy9mpdwiq/3QCdHovv 16kp8J0NENFAKS/QCq6B1x4=
=NjNB
-----END PGP SIGNATURE-----

#4 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 12 lines · Ingo Molnar
Quoted 9 lines · Mike Waychison

Hi Ingo,

I noticed that the wait_for_completion API extensions made it into mainline.

However, I posted that the patch in question is broken a while back:

http://marc.theaimsgroup.com/?l=linux-kernel&m=110131832828126&w=2

Quoted 8 lines
Quoted 1 line

Can we fix this?

(/me pokes himself in the eyes)

could you send an incremental patch against BK-curr?

Ingo

Attached.

- --
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: The opinions expressed in this email are held by me, and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB9tpBdQs4kOxk3/MRArUtAJ4+O7CCH8HdGqeREJb7yVQjOdJSkQCfRTIX al9JVahdnQcOJIwyIW3LeDU=
=zhk+
-----END PGP SIGNATURE-----

Fix up signal_pending and timeout paths for wait_for_completion API extensions.

---

 sched.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)
kernel/sched.c +13 -8
Index: linux-2.6-bk-curr/kernel/sched.c
===================================================================
@@ -3020,15 +3020,17 @@ wait_for_completion_timeout(struct compl
 			__set_current_state(TASK_UNINTERRUPTIBLE);
 			spin_unlock_irq(&x->wait.lock);
 			timeout = schedule_timeout(timeout);
-			if (!timeout)
-				goto out;
 			spin_lock_irq(&x->wait.lock);
+			if (!timeout) {
+				__remove_wait_queue(&x->wait, &wait);
+				goto out;
+			}
 		} while (!x->done);
 		__remove_wait_queue(&x->wait, &wait);
 	}
 	x->done--;
-	spin_unlock_irq(&x->wait.lock);
 out:
+	spin_unlock_irq(&x->wait.lock);
 	return timeout;
 }
 EXPORT_SYMBOL(wait_for_completion_timeout);
@@ -3048,6 +3050,7 @@ int fastcall __sched wait_for_completion
 		do {
 			if (signal_pending(current)) {
 				ret = -ERESTARTSYS;
+				__remove_wait_queue(&x->wait, &wait);
 				goto out;
 			}
 			__set_current_state(TASK_INTERRUPTIBLE);
@@ -3080,21 +3083,23 @@ wait_for_completion_interruptible_timeou
 		do {
 			if (signal_pending(current)) {
 				timeout = -ERESTARTSYS;
-				goto out_unlock;
+				__remove_wait_queue(&x->wait, &wait);
+				goto out;
 			}
 			__set_current_state(TASK_INTERRUPTIBLE);
 			spin_unlock_irq(&x->wait.lock);
 			timeout = schedule_timeout(timeout);
-			if (!timeout)
-				goto out;
 			spin_lock_irq(&x->wait.lock);
+			if (!timeout) {
+				__remove_wait_queue(&x->wait, &wait);
+				goto out;
+			}
 		} while (!x->done);
 		__remove_wait_queue(&x->wait, &wait);
 	}
 	x->done--;
-out_unlock:
-	spin_unlock_irq(&x->wait.lock);
 out:
+	spin_unlock_irq(&x->wait.lock);
 	return timeout;
 }
 EXPORT_SYMBOL(wait_for_completion_interruptible_timeout);