public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* sched_yield proposals/rationale
@ 2007-04-12  8:31 Buytaert_Steven
  2007-04-12  9:48 ` Sven-Thorsten Dietrich
  2007-04-12 13:31 ` Andi Kleen
  0 siblings, 2 replies; 15+ messages in thread
From: Buytaert_Steven @ 2007-04-12  8:31 UTC (permalink / raw)
  To: linux-kernel

Since the new 2.6.x O(1) scheduler I'm having latency problems. Probably due
to excessive use of sched_yield in code in components I don't have control
over. This 'problem'/behavioral change has been reported also by other
applications (e.g. OpenLDAP, Gnome netmeeting, Postgress, e.google...)

I have analysed the sched_yield code in kernel/sched.c (2.6.16 SLES10) and have 3 questions/proposals:

1) Would it be beneficial to give each task one try to be enqueued on the
end of the active queue (by means of a boolean flag, reset each time the
time slices reach 0 and it is put in the expired list by scheduler_tick)?

2) When a task is eventually put in the expired list in sched_yield, give it
back the full time slices round (as done in scheduler_tick), not with the
remaining slices as is done now?

3) Put the task in the expired list at a random position, not at the end as
is done now?

Rationales:

For 1) suppose the resource that the task wants to acquire (if any) and for
which it yields, since it is not available, is kept by another task that is
in the active list, behind this task. Putting the task on the expired list
would induce some kind of 'tail chasing'. This would be broken by 1.

For 2) When a task is put on the expired list with e.g. 1 time quantum left,
next time it gets the resource and is put on the expired list at the next
scheduler_tick occurence, before it has the chance to release the resource
again, keeping it for a longer time than necessary.

For 3) when the resource (if any) is requested by many tasks
regularly, always putting the yielding task at the end of the expired list
could result in 'unfairness' since the resource is handed out to the tasks
as they get on the cpu. The only 'fairness' that can be applied with yield
is than to insert in a random position.

Any insight on these proposed changes? Thanks

Steven Buytaert
--
La perfection est atteinte non quand il ne reste rien ajouter, mais quand il ne reste rien à enlever. (Antoine de Saint-Exupéry)


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-04-18  5:40 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-12  8:31 sched_yield proposals/rationale Buytaert_Steven
2007-04-12  9:48 ` Sven-Thorsten Dietrich
2007-04-12 13:31 ` Andi Kleen
2007-04-12 13:05   ` Buytaert_Steven
2007-04-12 13:27     ` Nick Piggin
2007-04-12 22:00       ` William Lee Irwin III
2007-04-12 13:31     ` Andi Kleen
2007-04-12 14:15       ` Buytaert_Steven
2007-04-12 21:04         ` Thomas Gleixner
2007-04-12 22:32         ` Bill Davidsen
2007-04-13  5:36           ` Buytaert_Steven
2007-04-13 19:46             ` Mark Lord
2007-04-17 19:37               ` Bill Davidsen
2007-04-18  5:40                 ` Buytaert_Steven
2007-04-12 21:37   ` William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox