Re: scheduler ignores need_resched flag in 2.2.x and 2.3.x?

From: Jamie Lokier (
Date: Tue Mar 21 2000 - 09:12:36 EST

Andi Kleen wrote:
> (Jamie Lokier) writes:
> > Jun Sun wrote:
> > > First of all, I think this is must-fix bug. (Any arguments here?)
> >
> > There are a few other scenarious where need_resched is missed, including
> > the last few instructions after ret_from_syscall. And it really does
> > happen there. I think it's a must-fix too, but the fact that neither my
> > nor Ingo's patch made it in suggests Linus thinks otherwise.
> Looks like the easiest way to fix such races would be to move need_resched
> back to a global variable (possible in an array indexed per CPU). Earlier
> Linux kernels (<2.0) had it this way, I'm not sure why it was changed.

Note that even the global variable still has the ret_from_sys_call race.

current->need_resched is used to avoid cache line ping pong between
processors I guess. Another easy way to fix the race would be to have a
per-CPU need_resched flag, and use need_resched [current->processor]
rather than current->need_resched.

For uniprocessors, going back to a global variable seems like a sensible
idea anyway. It is faster. Same goes for any other per-cpu data stored
in current.

-- Jamie

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:33 EST