![]() | ||||||||||
Messages in this thread |
Balbir Singh wrote: > > On Tue, Jan 10, 2006 at 09:03:07PM +0300, Oleg Nesterov wrote: > > > I don't have an answer, only a wild guess. > > > > Note that if P1 releases this semaphore before pre-woken P2 actually > > gets cpu what happens is: > > > > P1->up() just increments ->count, no wake_up() (fastpath) > > > > P2 takes the semaphore without schedule. > > > > So *may be* it was designed this way as some form of optimization, > > in this scenario P2 has some chances to run with sem held earlier. > > > > P1->up() will do a wake_up() only if count < 0. For no wake_up() > the count >=0 before the increment. This means that there is no one > sleeping on the semaphore. And this exactly happens. P1 returns from __down() with ->count == 0 and P2 pre-woken. Oleg. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ | |||||||||
| Last update: 2006-01-11 08:08 [from the cache] ©2003-2008 | ||||||||||