mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srivatsa Vaddagiri <vatsa@in.ibm.com>
To: Andi Kleen <ak@muc.de>
Cc: linux-kernel@vger.kernel.org,
	user-mode-linux-devel@lists.sourceforge.net,
	rusty@rustcorp.com.au, schwidefsky@de.ibm.com, jdike@addtoit.com,
	akpm@osdl.org, mingo@elte.hu, rmk+lkml@arm.linux.org.uk,
	nickpiggin@yahoo.com.au, Dipankar <dipankar@in.ibm.com>
Subject: Re: [RFC] (How to) Let idle CPUs sleep
Date: Sun, 8 May 2005 20:56:11 +0530	[thread overview]
Message-ID: <20050508152611.GA28956@in.ibm.com> (raw)
In-Reply-To: <m1vf5tvo8b.fsf@muc.de>

On Sun, May 08, 2005 at 03:31:00PM +0200, Andi Kleen wrote:
> I think the best way is to let other CPUs handle the load balancing
> for idle CPUs. Basically when a CPU goes fully idle then you mark
> this in some global data structure, 

nohz_cpu_mask already exists for this purpose.

> and CPUs doing load balancing after doing their own thing look for others 
> that need to be balanced too and handle them too. 

This is precisely what I had proposed in my watchdog implementation.

> When no CPU is left non idle then nothing needs to be load balanced anyways. 
> When a idle CPU gets a task it just gets an reschedule IPI as usual, that 
> wakes it up. 

True.

> 
> I call this the "scoreboard".
> 
> The trick is to evenly load balance the work over the remaining CPUs.
> Something simple like never doing work for more than 1/idlecpus is
> probably enough. 

Well, there is this imbalance_pct which acts as a trigger threshold before
which load balance won't happen.  I do take this into account before
waking up the sleeping idle cpu (the same imbalance_pct logic would 
have been followed by the idle CPU if it were to continue taking timer
ticks).

So I guess your 1/idlecpus and the imbalance_pct may act on parallel lines.

> In theory one could even use machine NUMA topology
> information for this, but that would be probably overkill for the
> first implementation.
> 
> With the scoreboard implementation CPus could be virtually idle
> forever, which I think is best for virtualization.
> 
> BTW we need a very similar thing for RCU too.

RCU is taken care of already, except it is broken. There is a small
race which is not fixed. Following patch (which I wrote aainst 2.6.10 kernel
maybe) should fix that race. I intend to post this patch after test
agaist more recent kernel.


--- kernel/rcupdate.c.org	2005-02-11 11:38:47.000000000 +0530
+++ kernel/rcupdate.c	2005-02-11 11:44:08.000000000 +0530
@@ -199,8 +199,11 @@ static void rcu_start_batch(struct rcu_c
  */
 static void cpu_quiet(int cpu, struct rcu_ctrlblk *rcp, struct rcu_state *rsp)
 {
+	cpumask_t tmpmask;
+
 	cpu_clear(cpu, rsp->cpumask);
-	if (cpus_empty(rsp->cpumask)) {
+	cpus_andnot(tmpmask, rsp->cpumask, nohz_cpu_mask);
+	if (cpus_empty(tmpmask)) {
 		/* batch completed ! */
 		rcp->completed = rcp->cur;
 		rcu_start_batch(rcp, rsp, 0);



-- 


Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560017

      reply	other threads:[~2005-05-08 15:25 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-07 18:27 Srivatsa Vaddagiri
2005-05-08  3:50 ` Rusty Russell
2005-05-08  4:14   ` Nick Piggin
2005-05-08 12:19     ` Srivatsa Vaddagiri
2005-05-09  6:27       ` Nick Piggin
2005-05-12  8:38         ` Srivatsa Vaddagiri
2005-05-11 18:03     ` Tony Lindgren
2005-05-12  8:46       ` Srivatsa Vaddagiri
2005-05-12 16:01         ` Lee Revell
2005-05-12 16:16           ` Tony Lindgren
2005-05-12 16:28             ` Jesse Barnes
2005-05-12 17:12               ` Srivatsa Vaddagiri
2005-05-12 17:59                 ` Jesse Barnes
2005-05-12 18:16                   ` Tony Lindgren
2005-05-13  6:27                   ` Srivatsa Vaddagiri
2005-05-12 18:08                 ` Martin Schwidefsky
2005-05-12 18:21                   ` Tony Lindgren
2005-05-13  6:23                   ` Srivatsa Vaddagiri
2005-05-13  7:16                     ` Nick Piggin
2005-05-13  8:04                       ` Ingo Molnar
2005-05-13  8:27                         ` Nick Piggin
2005-05-13  9:19                           ` Srivatsa Vaddagiri
2005-05-13  9:33                             ` Nick Piggin
2005-05-12 21:16                 ` George Anzinger
2005-05-12 21:35                   ` Jesse Barnes
2005-05-12 22:15                     ` George Anzinger
2005-05-13  0:43                       ` Jesse Barnes
2005-05-13  6:31                         ` Srivatsa Vaddagiri
2005-06-30 12:47     ` Srivatsa Vaddagiri
2005-07-06 17:31       ` Srivatsa Vaddagiri
2005-05-08 10:13   ` Arjan van de Ven
2005-05-08 13:33     ` Andi Kleen
2005-05-08 13:44       ` Arjan van de Ven
2005-05-08 14:53         ` Andi Kleen
2005-05-08 13:31 ` Andi Kleen
2005-05-08 15:26   ` Srivatsa Vaddagiri [this message]

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=20050508152611.GA28956@in.ibm.com \
    --to=vatsa@in.ibm.com \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=dipankar@in.ibm.com \
    --cc=jdike@addtoit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nickpiggin@yahoo.com.au \
    --cc=rmk+lkml@arm.linux.org.uk \
    --cc=rusty@rustcorp.com.au \
    --cc=schwidefsky@de.ibm.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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

Powered by JetHome