Re: [PATCH] Remove RCU abuse in cpu_idle()

From: Nick Piggin
Date: Sun Dec 19 2004 - 20:16:58 EST


On Sun, 2004-12-19 at 17:59 -0700, Zwane Mwaikambo wrote:
> On Sat, 18 Dec 2004, Nish Aravamudan wrote:
>
> > All of these schedule_timeout() calls are broken. They do not set the
> > state before hand and therefore will return early. Since you're not
> > checking for signals and there are no waitqueue events around the
> > code, I'm assuming you can just use ssleep(1) instead of the current
> > schedule_timeout() calls.
>
> Returning early is fine (and will happen if the other processors are
> busy), we're spinning on a condition, but yes ssleep() could be used
> instead.
>

Hi Zwane,

This thread can possibly be stalled forever if there is a CPU hog
running, right?

In which case, you will want to use ssleep rather than a busy loop.

Another alternative may be to use more complex logic to detect that a
CPU is not in the idle loop at all. In that case, a simple cpu_relax
type spin loop should be OK, because the synchronisation would be
achieved very quickly.

Nick


-
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/