Re: [PATCH] do_wait fix for 2.6.10-rc1
From: Sripathi Kodi
Date: Mon Nov 08 2004 - 09:31:35 EST
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@xxxxxxxxxx>
--- 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:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/