public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Chris Friesen" <cfriesen@nortel.com>
To: davids@webmaster.com
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
	Ingo Molnar <mingo@elte.hu>,
	"Zhang, Yanmin" <yanmin_zhang@linux.intel.com>,
	Arjan van de Ven <arjan@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: sched_yield: delete sysctl_sched_compat_yield
Date: Mon, 03 Dec 2007 13:56:56 -0600	[thread overview]
Message-ID: <47545F88.6070609@nortel.com> (raw)
In-Reply-To: <MDEHLPKNGKAHNMBLJOLKEEHJIJAC.davids@webmaster.com>

David Schwartz wrote:
> Chris Friesen wrote:


> If CFS really can't support sched_yield's semantics, then it should just
> not, and that's that. Return ENOSYS and admit that the behavior sched_yield
> is documented to have simply can't be supported by the scheduler.

That's just it though...sched_yield() with SCHED_OTHER doesn't have well 
defined semantics, so we can do just about anything we want.

The issue is mostly how to work around existing apps that (invalidly) 
expect certain behaviour from sched_yield().

>>The problem is where do we insert the task that is yielding?  CFS is
>>based around a tree structure ordered by time.

> We put it exactly where we would have when its timeslice ran out. If we can
> reward it a little bit, that's great. But if not, we can live with that.
> Just imagine that the timer interrupt fired to indicate the end of the
> thread's run time when the thread called 'sched_yield'.

CFS doesn't really do "timeslice".  But in essence what you are 
describing is the default behaviour currently...it simply removes the 
task from the tree and reinserts it based on how much cpu time it used up.

> Then what does he do when the task runs out of run time? It's hard to
> imagine we can't do that when the task calls sched_yield.

It gets reinserted into the tree at a position based on how much cpu 
time it used.  This is exactly the current sched_yield() behaviour.

>>It just says to delay the task,
>>without specifying how long or what the task is waiting *for*.

> That is not true. The task is waiting for something that will be done by
> another thread that is ready-to-run and at the same priority level. The task
> does not need to wait until the thing is guaranteed done but wishes to wait
> until it is more likely to be done. This is an often-misused but sometimes
> sensible thing to do.

The scheduler still doesn't know specifically what the task is waiting for.

> Sure, if there is more information. But if all you really want to do is wait
> until other threads at the same static priority level have had a chance to
> run, then sched_yield is the right API.

Technically, all of SCHED_OTHER has static priority level zero.  Thus 
the "right" thing to do is to allow all SCHED_OTHER tasks to run, 
including the ones with the highst possible nice level.

This is the alternate implementation in the current code, but it has 
latency implications that may be unexpected by applications written for 
the previous 2.6 behaviour.

Chris


  reply	other threads:[~2007-12-03 19:57 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-27  9:33 sched_yield: delete sysctl_sched_compat_yield Zhang, Yanmin
2007-11-27 11:17 ` Ingo Molnar
2007-11-27 22:57 ` Arjan van de Ven
2007-11-30  2:46   ` Nick Piggin
2007-11-30  2:51     ` Arjan van de Ven
2007-11-30  3:02       ` Nick Piggin
2007-11-30  3:15     ` Zhang, Yanmin
2007-11-30  3:29       ` Nick Piggin
2007-11-30  4:32         ` Zhang, Yanmin
2007-11-30 10:08         ` Ingo Molnar
2007-12-03  4:27           ` Nick Piggin
2007-12-03  8:45             ` Ingo Molnar
2007-12-03  9:17               ` Nick Piggin
2007-12-03  9:35                 ` Zhang, Yanmin
2007-12-03  9:57                 ` Ingo Molnar
2007-12-03 10:15                   ` Nick Piggin
2007-12-03 10:33                     ` Ingo Molnar
2007-12-03 11:02                       ` Nick Piggin
2007-12-03 11:37                         ` Ingo Molnar
2007-12-03 17:04                           ` David Schwartz
2007-12-03 17:37                             ` Chris Friesen
2007-12-03 19:12                               ` David Schwartz
2007-12-03 19:56                                 ` Chris Friesen [this message]
2007-12-03 21:39                                   ` Mark Lord
2007-12-03 21:48                                     ` Ingo Molnar
2007-12-03 21:57                                       ` Mark Lord
2007-12-03 22:05                                         ` Ingo Molnar
2007-12-03 22:18                                           ` Mark Lord
2007-12-03 22:33                                             ` Ingo Molnar
2007-12-04  0:18                                               ` Nick Piggin
2007-12-04  0:30                                           ` David Schwartz
2007-12-04  2:09                                             ` Nick Piggin
2007-12-04  1:02                           ` Nick Piggin
2007-12-03  9:41               ` Zhang, Yanmin
2007-12-03 10:17                 ` Ingo Molnar
2007-12-03  9:29           ` Zhang, Yanmin
2007-12-03 10:05             ` Ingo Molnar
2007-12-04  6:40               ` Zhang, Yanmin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47545F88.6070609@nortel.com \
    --to=cfriesen@nortel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=davids@webmaster.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nickpiggin@yahoo.com.au \
    --cc=yanmin_zhang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox