mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Con Kolivas <kernel@kolivas.org>,
	linux kernel mailing list <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>,
	gaxt <gaxt@rogers.com>, Mike Galbraith <efault@gmx.de>
Subject: Re: Scheduler activations (IIRC) question
Date: Sat, 16 Aug 2003 01:54:08 +0100	[thread overview]
Message-ID: <20030816005408.GA21356@mail.jlokier.co.uk> (raw)
In-Reply-To: <20030815235431.GT1027@matchmail.com>

Mike Fedyk wrote:
> On Sat, Aug 16, 2003 at 12:03:12AM +0100, Jamie Lokier wrote:
> > I think it's been done before, under the name "scheduler activations",
> > on some other kernel.
> > 
> 
> Wouldn't futexes help with this?

Futexes are great for the waking up part, not so great for putting
another task to sleep :)

I see two ways to use a futex.

   1. Active task changes a synchronisation word.
   2. Active task FUTEX_WAKEs the shadow task before syscall.
   3. Syscall.
   4. Active task restores synchronisation word.
      ..time passes..
   5. Shadow task runs.
   6. Looks at synchronisation word, which says "go back to sleep".
   7. Shadow task sleeps with FUTEX_WAIT.

This isn't bad, except that a shadow task runs every time we do a
potentially blocking system call from the active task, _or_ is often
ready to run.

If it's just often ready to run, that's not a problem.  If it always
runs immediately, that's two unnecessary context switches per system
call; quite an overhead, and I might as well hand off system calls to
helper threads in that case :)

Next way is the same, except that control is always handed to the
shadow task and the active task, when the system call is finished,
queues the current state machine for the shadow task to pick it up and
then sleeps.  Effectively the active and shadow tasks swap roles on
each system call.

This may or may not be better, depending on whether we've reduced the
average number of context switches to 1 or increased it to 1 :)

It'd wreck the kernel scheduler's interactivity heuristics, too :):)

The first futex method would be quite efficient if a variant of
FUTEX_WAIT was clever enough not to need to be scheduled just to go
back to sleep when the word has the "go back to sleep" value.

Third way is just to use SIGCONT and SIGSTOP.  Not the fastest, but
perhaps faster than the futex-induced context switches.  It'd need to
be measured.

None of these will work well if "wakee" tasks are able to run
immediately after being woken, before "waker" tasks get a chance to
either block or put the wakees back to sleep.

-- Jamie

  reply	other threads:[~2003-08-16  0:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-15 15:49 [PATCH] O16int for interactivity Con Kolivas
2003-08-15 18:26 ` Timothy Miller
2003-08-15 18:45   ` Richard B. Johnson
2003-08-16  2:31   ` Con Kolivas
2003-08-18 15:46     ` Timothy Miller
2003-08-18 15:43       ` Nick Piggin
2003-08-18 19:48         ` Timothy Miller
2003-08-18 22:46           ` Nick Piggin
2003-08-15 19:00 ` Felipe Alfaro Solana
2003-08-16  2:14   ` [PATCH]O16.1int was " Con Kolivas
2003-08-15 21:01 ` Mike Fedyk
2003-08-15 23:03 ` Scheduler activations (IIRC) question Jamie Lokier
2003-08-15 23:54   ` Mike Fedyk
2003-08-16  0:54     ` Jamie Lokier [this message]
2003-08-16  6:14       ` Mike Galbraith
2003-08-16 14:18         ` Jamie Lokier
2003-08-17  5:51           ` Mike Galbraith
2003-08-17  6:55             ` Jamie Lokier
2003-08-17  7:05               ` Nick Piggin
2003-08-17  8:34               ` Mike Galbraith
2003-08-17 17:12                 ` Jamie Lokier
2003-08-17 17:15                   ` Arjan van de Ven
2003-08-17 18:26                     ` Jamie Lokier
2003-08-17 18:27                   ` Mike Galbraith
2003-08-17 18:29                     ` Jamie Lokier
2003-08-17 18:46                     ` Jamie Lokier
2003-08-16 20:54         ` Ingo Oeser
2003-08-16 21:39           ` Jamie Lokier
     [not found]             ` <20030817144203.J670@nightmaster.csn.tu-chemnitz.de>
2003-08-17 20:02               ` Jamie Lokier
2003-08-18  0:23                 ` William Lee Irwin III
2003-08-18 10:38                 ` Ingo Oeser
2003-08-18 13:09                   ` Jamie Lokier
2003-08-16  7:01 ` [PATCH] O16int for interactivity Con Kolivas
2003-08-18 10:08 ` Apurva Mehta
2003-08-18 10:30   ` Con Kolivas
2003-08-18 12:13     ` Apurva Mehta

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=20030816005408.GA21356@mail.jlokier.co.uk \
    --to=jamie@shareable.org \
    --cc=akpm@osdl.org \
    --cc=efault@gmx.de \
    --cc=gaxt@rogers.com \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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

all inboxes | Powered by JetHome®