linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Lynch <ntl@pobox.com>
To: linux-kernel@vger.kernel.org
Cc: linuxppc-dev@ozlabs.org, Ingo Molnar <mingo@elte.hu>,
	Paul Mackerras <paulus@samba.org>,
	Anton Blanchard <anton@samba.org>
Subject: [RFC/PATCH 1/3] sched: support arch override of sched_group cpu power
Date: Wed, 18 Jun 2008 19:29:32 -0500	[thread overview]
Message-ID: <1213835374-10868-2-git-send-email-ntl@pobox.com> (raw)
In-Reply-To: <1213835374-10868-1-git-send-email-ntl@pobox.com>

Add a new sched domain flag, SD_ASYM_CPU_POWER, which signifies that
the architecture may override the cpu power for a cpu via a hook in
init_sched_groups_power().  Add a dummy definition of arch_cpu_power()
which conforms with the existing behavior.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
---
 include/linux/sched.h |    1 +
 kernel/sched.c        |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index c5d3f84..cfbefca 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -713,6 +713,7 @@ enum cpu_idle_type {
 #define SD_SHARE_PKG_RESOURCES	512	/* Domain members share cpu pkg resources */
 #define SD_SERIALIZE		1024	/* Only a single load balancing instance */
 #define SD_WAKE_IDLE_FAR	2048	/* Gain latency sacrificing cache hit */
+#define SD_ASYM_CPU_POWER	4096	/* Domain members of unequal power */
 
 #define BALANCE_FOR_MC_POWER	\
 	(sched_smt_power_savings ? SD_POWERSAVINGS_BALANCE : 0)
diff --git a/kernel/sched.c b/kernel/sched.c
index eaf6751..3fba083 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6761,6 +6761,13 @@ static void free_sched_groups(const cpumask_t *cpu_map, cpumask_t *nodemask)
 }
 #endif
 
+#ifndef arch_cpu_power
+static inline unsigned int arch_cpu_power(int cpu, unsigned int default_power)
+{
+	return default_power;
+}
+#endif
+
 /*
  * Initialize sched groups cpu_power.
  *
@@ -6789,6 +6796,13 @@ static void init_sched_groups_power(int cpu, struct sched_domain *sd)
 
 	sd->groups->__cpu_power = 0;
 
+	if (!child && (sd->flags & SD_ASYM_CPU_POWER)) {
+		unsigned int power = arch_cpu_power(cpu, SCHED_LOAD_SCALE);
+
+		sg_inc_cpu_power(sd->groups, power);
+		return;
+	}
+
 	/*
 	 * For perf policy, if the groups in child domain share resources
 	 * (for example cores sharing some portions of the cache hierarchy
-- 
1.5.5

  reply	other threads:[~2008-06-19  0:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-19  0:29 [RFC/PATCH 0/3] sched: allow arch override of cpu power Nathan Lynch
2008-06-19  0:29 ` Nathan Lynch [this message]
2008-06-19  0:29 ` [RFC/PATCH 2/3] add cpu_power to machdep_calls, override SD_SIBLING_INIT Nathan Lynch
2008-06-19  0:29 ` [RFC/PATCH 3/3] adjust cpu power for secondary threads on POWER6 Nathan Lynch
2008-06-19  2:58   ` Olof Johansson
2008-06-19  3:03     ` Olof Johansson
2008-06-19  9:50 ` [RFC/PATCH 0/3] sched: allow arch override of cpu power Ingo Molnar
2008-06-19 17:09   ` Nathan Lynch
2008-06-26 19:49 ` Breno Leitao
2008-06-27 14:23   ` Nathan Lynch

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=1213835374-10868-2-git-send-email-ntl@pobox.com \
    --to=ntl@pobox.com \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    /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;
as well as URLs for NNTP newsgroup(s).