Re: sched_yield() makes OpenLDAP slow
From: Bernardo Innocenti
Date: Thu Aug 18 2005 - 22:10:46 EST
Nick Piggin wrote:
> We class the SCHED_OTHER policy as having a single priority, which
> I believe is allowed (and even makes good sense, because dynamic
> and even nice priorities aren't really well defined).
>
> That also makes our sched_yield() behaviour correct.
>
> AFAIKS, sched_yield should only really be used by realtime
> applications that know exactly what they're doing.
I'm pretty sure this has already been discussed in the
past, but I fail to see why this new behavior of
sched_yield() would be more correct.
In the OpenLDAP bug discussion, one of the developers
considers this a Linux quirk needing a workaround, not
a real bug in OpenLDAP.
As I understand it, the old behavior was to push the
yielding process to the end of the queue for processes
with the same niceness. This is somewhat closer to
the (vague) definition in the POSIX man pages:
The sched_yield() function shall force the running
thread to relinquish the processor until it again
becomes the head of its thread list. It takes no arguments.
Pushing the process far behind in the queue, even after
niced CPU crunchers, appears a bit extreme. It seems
most programs expect sched_yield() to only reschedule
the calling thread wrt its sibling threads, to be used
to implement do-it-yourself spinlocks and the like.
--
// Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/ http://www.develer.com/
-
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/