From: Hubertus Franke <frankeh@watson.ibm.com>
To: Mika Liljeberg <Mika.Liljeberg@welho.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
Benjamin LaHaise <bcrl@redhat.com>,
Linus Torvalds <torvalds@transmeta.com>,
linux-kernel@vger.kernel.org
Subject: Re: Context switch times
Date: Tue, 9 Oct 2001 16:37:24 -0400 [thread overview]
Message-ID: <20011009163724.A4903@watson.ibm.com> (raw)
In-Reply-To: <E15pWfR-0006g5-00@the-village.bc.nu> <3BC02709.A8E6F999@welho.com>
In-Reply-To: <3BC02709.A8E6F999@welho.com>; from Mika Liljeberg on Sun, Oct 07, 2001 at 12:57:29PM +0300
* Mika Liljeberg <Mika.Liljeberg@welho.com> [20011007 05;57]:"
> Alan Cox wrote:
> > This isnt idle speculation - I've done some minimal playing with this but
> > my initial re-implementation didnt handle SMP at all and I am still not 100%
> > sure how to resolve SMP or how SMP will improve out of the current cunning
> > plan.
>
> Here's some idle speculation on SMP to top it off. :) I tend to think
> that the load balancing between CPUs should be a completely separate
> algorithim and should not necessarily be run at every schedule(). The
> idea is to compeletely decouple the problem of scheduling a single CPU
> between tasks and the problem of load balancing between the CPUs, making
> each problem simpler to solve.
>
This is what we implemented as an extension to our MQ scheduler.
I will present on the results for this during ALS technical session:
"CPU Pooling and Load Balancing in Linux MultiQueue Scheduling".
If interested I can already put an earlier version on lse.sourceforge.net.
It basically does (1) and (2). (3) is done unintelligently right now.
> Consider the following basic rules:
>
> A) When a new task comes along, pick the "least loaded" CPU and lock the
> new task onto that.
> B) Whenever the load imbalance between least loaded CPU and most loaded
> CPU becomes too great, move one or more tasks from most loaded CPU to
> the least loaded CPU.
>
> The rules themselves should be self-explanatory: A provides initial load
> balancing, while B tries to keep the balance (with a sensible hysteresis
> to avoid thrashing). However, there are a few minor details to solve:
>
> 1) How to determine the load of a CPU? If we can quantify this clearly,
> we can easily set a hysteresis level to trigger load balancing between
> two CPUs.
> 2) When and how often to check for load imbalance?
> 3) How to select the task(s) that should be moved between two CPUs to
> correct an imbalance?
>
> For problems 1 and 2 I propose the following solution: Insert the the
> load balancing routine itself as a (fake) task on each CPU and run it
> when the CPU gets around to it. The load balancer should behave almost
> like a CPU-bound task, scheduled on the lowest priority level with other
> runnable tasks. The last bit is important: the load balancer should not
> be allowed to starve but should be invoked approximately once every
> "full rotation" of the scheduler.
>
> With the above it is easy to estimate the load of a CPU. We can simply
> use the elapsed time between two invokations of the load balancer task.
> When the load balancer task of a particular CPU gets run, it chalks up
> the elapsed time on a score board somewhere, and checks whether there is
> a significant imbalance between itself and some other CPU. If there is,
> it commences to move some tasks between itself and the other CPU (note
> rule B, though, it should be enough to mess with just two CPU queues at
> a time to minimize balancing and locking overhead).
>
> Problem 3 is tricky. Basically, there should be a cost/benefit function
> F(tasks to move) that should be minimized. Ideally F(task_i), the
> cost/benefit of moving a single task, would be calculated as a byproduct
> of the CPU scheduler algorithm.
>
> F(task_i) might be function of elapsed time since task_i was last
> scheduled and the average time slice used by task_i, to account for the
> probable cache hit. This would leave it up to the load balancer to move
> as many lowest cost tasks to a new CPU as is needed to correct the
> imbalance (average time slices used by each task would be needed in
> order to make this decision).
>
> Naturally, some additional rules might be necessary to make a task
> eligible for moving, e.g., never move the only/last CPU bound task to
> another CPU. In addition, it might actually make sense to move at most
> one task at each invocation of the load balancer, to further reduce the
> probability of thrashing. The load would still converge fairly quickly
> towards a balanced state. It would also scale fairly well with the
> number of CPUs.
>
> How does that sound?
>
> MikaL
> -
> 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/
next prev parent reply other threads:[~2001-10-09 22:37 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-04 21:04 Context switch times Mike Kravetz
2001-10-04 21:14 ` arjan
2001-10-04 21:25 ` David S. Miller
2001-10-04 21:39 ` Richard Gooch
2001-10-04 21:52 ` David S. Miller
2001-10-04 21:55 ` Benjamin LaHaise
2001-10-04 22:35 ` Davide Libenzi
2001-10-04 22:49 ` Mike Kravetz
2001-10-04 22:42 ` Linus Torvalds
2001-10-04 22:53 ` Benjamin LaHaise
2001-10-05 15:13 ` Alan Cox
2001-10-05 17:49 ` george anzinger
2001-10-05 22:29 ` Alan Cox
2001-10-05 22:56 ` Davide Libenzi
2001-10-05 23:04 ` Alan Cox
2001-10-05 23:16 ` Davide Libenzi
2001-10-05 23:17 ` Alan Cox
2001-10-05 23:21 ` Davide Libenzi
2001-10-05 23:43 ` Roger Larsson
2001-10-07 1:20 ` george anzinger
2001-10-07 1:33 ` Bill Davidsen
2001-10-07 9:56 ` Alan Cox
2001-10-06 2:24 ` Albert D. Cahalan
2001-10-06 2:57 ` Davide Libenzi
2001-10-07 9:57 ` Mika Liljeberg
2001-10-07 13:03 ` Ingo Oeser
2001-10-07 13:48 ` Mika Liljeberg
2001-10-07 14:24 ` Ingo Oeser
2001-10-07 14:33 ` Mika Liljeberg
2001-10-07 18:00 ` george anzinger
2001-10-07 22:06 ` Mika Liljeberg
2001-10-07 22:31 ` Davide Libenzi
2001-10-07 22:33 ` Mika Liljeberg
2001-10-07 23:49 ` george anzinger
2001-10-08 21:07 ` Mika Liljeberg
2001-10-08 22:54 ` discontig physical memory Petko Manolov
2001-10-08 23:05 ` David S. Miller
2001-10-08 23:18 ` Petko Manolov
2001-10-08 23:29 ` David S. Miller
2001-10-09 0:34 ` Petko Manolov
2001-10-09 0:36 ` Petko Manolov
2001-10-09 1:37 ` David S. Miller
2001-10-09 2:43 ` Petko Manolov
2001-10-08 15:19 ` Context switch times bill davidsen
2001-10-10 6:07 ` Mike Fedyk
2001-10-07 18:39 ` Davide Libenzi
2001-10-09 20:37 ` Hubertus Franke [this message]
2001-10-09 23:50 ` george anzinger
2001-10-11 10:52 ` Hubertus Franke
2001-10-04 23:41 ` Mike Kravetz
2001-10-04 23:50 ` Linus Torvalds
2001-10-05 15:15 ` Eric W. Biederman
2001-10-04 23:56 ` Davide Libenzi
2001-10-05 0:45 ` Andrea Arcangeli
2001-10-05 4:35 ` Mike Kravetz
2001-10-07 17:59 ` Andrea Arcangeli
2001-10-07 19:54 ` george anzinger
2001-10-07 20:24 ` Andrea Arcangeli
2001-10-09 4:55 ` Richard Gooch
2001-10-09 5:00 ` David S. Miller
2001-10-09 13:49 ` bill davidsen
-- strict thread matches above, loose matches on Subject: below --
2001-10-05 6:31 Michailidis, Dimitrios
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=20011009163724.A4903@watson.ibm.com \
--to=frankeh@watson.ibm.com \
--cc=Mika.Liljeberg@welho.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=bcrl@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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