public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sripathi Kodi <sripathik@in.ibm.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org, Roland McGrath <roland@redhat.com>,
	Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@osdl.org>,
	dino@in.ibm.com
Subject: Re: [PATCH] do_wait fix for 2.6.10-rc1
Date: Mon, 08 Nov 2004 19:57:56 +0530	[thread overview]
Message-ID: <418F826C.2060500@in.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0411051101500.30457@ppc970.osdl.org>

On Fri, Nov 05, 2004 at 11:17:44AM -0800, Linus Torvalds wrote:

>> I think the real fix is to notice when we have dropped the tasklist_lock 
>> inside the loop, and _not_ re-schedule in that case, but just repeat the 
>> loop from the top.
>> 
>> And that's easy enough to do: set current->state to TASK_RUNNING in the
>> cases where we might have raced with somebody else. That will cause the
>> schedule() to be a no-op.
>> 
>> We could also choose to just wake up all our siblings "child_wait" lists
>> when we reap a child ourselves. They likely got woken up _anyway_ when the
>> child died in the first place, after all. For extra bonus points, make the
>> child_wait thing use the self-removing waitqueue entries, ie use
>> "prepare_to_wait()" instead of add_wait_queue(), and move it after the
>> "repeat:" thing.
>> 
>> 		Linus
>  
>

Linus,

Thanks for your suggestions. I have attached the re-done patch. I have 
implemented your first suggestion because it was much easier. I hope it 
looks better now.

Thanks and regards,
Sripathi Kodi.

Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>

--- linux-2.6.10-rc1/kernel/exit.c	2004-11-08 23:38:17.358375128 +0530
+++ /home/sripathi/12013/patch/take2/exit.c	2004-11-08 23:33:44.973783880 +0530
@@ -1345,8 +1345,10 @@ repeat:
 				break;
 			default:
 			// case EXIT_DEAD:
-				if (p->exit_state == EXIT_DEAD)
-					continue;
+				if (p->exit_state == EXIT_DEAD) {
+					current->state = TASK_RUNNING;
+					break;
+				}
 			// case EXIT_ZOMBIE:
 				if (p->exit_state == EXIT_ZOMBIE) {
 					/*
@@ -1363,6 +1365,7 @@ repeat:
 					/* He released the lock.  */
 					if (retval != 0)
 						goto end;
+					current->state = TASK_RUNNING;
 					break;
 				}
 check_continued:



  parent reply	other threads:[~2004-11-08 14:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-05  9:57 [PATCH] do_wait fix for 2.6.10-rc1 Sripathi Kodi
2004-11-05 10:03 ` Ingo Molnar
     [not found] ` <Pine.LNX.4.58.0411051101500.30457@ppc970.osdl.org>
2004-11-08 14:27   ` Sripathi Kodi [this message]
2004-11-08 16:01     ` Linus Torvalds
2004-11-08 16:13       ` Linus Torvalds
2004-11-08 16:37         ` Linus Torvalds
2004-11-09  1:09           ` Linus Torvalds
2004-11-09 14:31             ` Dinakar Guniguntala
2004-11-09 16:11               ` Linus Torvalds
2004-11-10 14:35                 ` Dinakar Guniguntala
2004-11-10 17:04                   ` Linus Torvalds
2004-11-11 11:20                     ` Sripathi Kodi

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=418F826C.2060500@in.ibm.com \
    --to=sripathik@in.ibm.com \
    --cc=akpm@osdl.org \
    --cc=dino@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=torvalds@osdl.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