2003-07-01 04:03:03

by Linus Torvalds

[permalink] [raw]
Subject: Re: PROBLEM: Bug in __pollwait() can cause select() and poll() to hang in 2.4.22-pre2 -- second try


On Tue, 1 Jul 2003, Rusty Russell wrote:
>
> Linus? See thread below: poll_wait is called with task state !=
> TASK_RUNNING, but can do a yield on low memory, causing eternal hangs.

Hint: 2.5.x does not have this problem, because the yield() in 2.5.x isn't
buggy.

So the proper fix is to just fix yield() on 2.4.x.

Linus



2003-07-01 05:03:04

by Rusty Russell

[permalink] [raw]
Subject: Re: PROBLEM: Bug in __pollwait() can cause select() and poll() to hang in 2.4.22-pre2 -- second try

In message <[email protected]> you write:
>
> On Tue, 1 Jul 2003, Rusty Russell wrote:
> >
> > Linus? See thread below: poll_wait is called with task state !=
> > TASK_RUNNING, but can do a yield on low memory, causing eternal hangs.
>
> Hint: 2.5.x does not have this problem, because the yield() in 2.5.x isn't
> buggy.
>
> So the proper fix is to just fix yield() on 2.4.x.

Thanks Linus.

Um, Ray? 2.4's yield also does:

void yield(void)
{
set_current_state(TASK_RUNNING);
sys_sched_yield();
schedule();
}

So how did the below patch make any difference?

Now thoroughly confused,
Rusty.

--- linux-2.4.22-pre2.orig/mm/page_alloc.c Thu Nov 28 17:53:15 2002
+++ linux-2.4.22-pre2/mm/page_alloc.c Fri Jun 27 13:47:49 2003
@@ -418,6 +418,7 @@
return NULL;

/* Yield for kswapd, and try again */
+ set_current_state(TASK_RUNNING);
yield();
goto rebalance;
}

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

2003-07-02 17:51:54

by Ray Bryant

[permalink] [raw]
Subject: Re: PROBLEM: Bug in __pollwait() can cause select() and poll() to hang in 2.4.22-pre2 -- second try

Rusty Russell wrote:

> Um, Ray? 2.4's yield also does:
>
> void yield(void)
> {
> set_current_state(TASK_RUNNING);
> sys_sched_yield();
> schedule();
> }
>
> So how did the below patch make any difference?
>
> Now thoroughly confused,
> Rusty.
>
> --- linux-2.4.22-pre2.orig/mm/page_alloc.c Thu Nov 28 17:53:15 2002
> +++ linux-2.4.22-pre2/mm/page_alloc.c Fri Jun 27 13:47:49 2003
> @@ -418,6 +418,7 @@
> return NULL;
>
> /* Yield for kswapd, and try again */
> + set_current_state(TASK_RUNNING);
> yield();
> goto rebalance;
> }
>
> --
> Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
>

Duh. My fault. I didn't see this in 2.4.22-pre2. Some checking shows
that it is also in 2.4.20. How this didn't get into our SGI 2.4.20 tree
is beyond me (this where we originally found this problem). So there is
no problem in 2.4.22-pre2.

Rusty -- thanks for your perseverence on this.

--
Best Regards,
Ray
-----------------------------------------------
Ray Bryant
512-453-9679 (work) 512-507-7807 (cell)
Jun 23-Jul 18 I will be at: 970-513-4743
[email protected] [email protected]
The box said: "Requires Windows 98 or better",
so I installed Linux.
-----------------------------------------------

2003-07-03 01:08:50

by Rusty Russell

[permalink] [raw]
Subject: Re: PROBLEM: Bug in __pollwait() can cause select() and poll() to hang in 2.4.22-pre2 -- second try

In message <[email protected]> you write:
> Duh. My fault. I didn't see this in 2.4.22-pre2. Some checking shows
> that it is also in 2.4.20. How this didn't get into our SGI 2.4.20 tree
> is beyond me (this where we originally found this problem). So there is
> no problem in 2.4.22-pre2.
>
> Rusty -- thanks for your perseverence on this.

Hey, glad I could help.

As for perseverance, it's an occupational hazard. Linus has said
before that he doesn't want patches which don't get aggressively
pushed by someone, and indeed, they get lost. Hence the Trivial Patch
Monkey...

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