public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gautham R Shenoy <ego@in.ibm.com>
To: "Ingo Molnar" <mingo@elte.hu>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	"Vaidyanathan Srinivasan" <svaidy@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, "Balbir Singh" <balbir@in.ibm.com>,
	Suresh Siddha <suresh.b.siddha@intel.com>,
	"Andi Kleen" <andi@firstfloor.org>,
	Randy Dunlap <randy.dunlap@oracle.com>,
	Gautham R Shenoy <ego@in.ibm.com>
Subject: [RFC PATCH 2 2/2] sched: Nominate a power-efficient ilb in select_nohz_balancer()
Date: Tue, 14 Apr 2009 10:25:35 +0530	[thread overview]
Message-ID: <20090414045535.7645.31641.stgit@sofia.in.ibm.com> (raw)
In-Reply-To: <20090414045356.7645.33369.stgit@sofia.in.ibm.com>

The CPU that first goes idle becomes the idle-load-balancer and remains
that until either it picks up a task or till all the CPUs of the system
goes idle.

Optimize this further to allow it to relinquish it's post
once all it's siblings in the power-aware sched_domain go idle, thereby
allowing the whole package-core to go idle. While relinquising the post,
nominate another an idle-load balancer from a semi-idle core/package.

Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
---

 kernel/sched.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index d702be7..bbf367d 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4402,8 +4402,24 @@ int select_nohz_load_balancer(int stop_tick)
 			/* make me the ilb owner */
 			if (atomic_cmpxchg(&nohz.load_balancer, -1, cpu) == -1)
 				return 1;
-		} else if (atomic_read(&nohz.load_balancer) == cpu)
+		} else if (atomic_read(&nohz.load_balancer) == cpu) {
+			int new_ilb;
+
+			if (!(sched_smt_power_savings ||
+						sched_mc_power_savings))
+				return 1;
+			/*
+			 * Check to see if there is a more power-efficient
+			 * ilb.
+			 */
+			new_ilb = find_new_ilb(cpu);
+			if (new_ilb < nr_cpu_ids && new_ilb != cpu) {
+				atomic_set(&nohz.load_balancer, -1);
+				resched_cpu(new_ilb);
+				return 0;
+			}
 			return 1;
+		}
 	} else {
 		if (!cpumask_test_cpu(cpu, nohz.cpu_mask))
 			return 0;


  parent reply	other threads:[~2009-04-14  4:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14  4:55 [RFC PATCH v2 0/2] sched: Nominate a power-efficient ILB Gautham R Shenoy
2009-04-14  4:55 ` [RFC PATCH 2 1/2] sched: Nominate idle load balancer from a semi-idle package Gautham R Shenoy
2009-04-14 10:01   ` [tip:sched/core] " tip-bot for Gautham R Shenoy
2009-04-14 17:32   ` [RFC PATCH 2 1/2] " Randy Dunlap
2009-04-14  4:55 ` Gautham R Shenoy [this message]
2009-04-14 10:01   ` [tip:sched/core] sched: Nominate a power-efficient ilb in select_nohz_balancer() tip-bot for Gautham R Shenoy
2009-04-14  9:48 ` [RFC PATCH v2 0/2] sched: Nominate a power-efficient ILB Peter Zijlstra
2009-04-14  9:58   ` Gautham R Shenoy
2009-04-22  1:05 ` Suresh Siddha
2009-04-26 16:56   ` Vaidyanathan Srinivasan

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=20090414045535.7645.31641.stgit@sofia.in.ibm.com \
    --to=ego@in.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=andi@firstfloor.org \
    --cc=balbir@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=randy.dunlap@oracle.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=svaidy@linux.vnet.ibm.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