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 2/3] add cpu_power to machdep_calls, override SD_SIBLING_INIT
Date: Wed, 18 Jun 2008 19:29:33 -0500 [thread overview]
Message-ID: <1213835374-10868-3-git-send-email-ntl@pobox.com> (raw)
In-Reply-To: <1213835374-10868-1-git-send-email-ntl@pobox.com>
Add a cpu_power() call to machdep_calls, which will allow platforms to
override the scheduler's default cpu power calculation. If the
platform does not provide a cpu_power() method, the scheduler's
default value is used.
Copy the default SD_SIBLING_INIT to powerpc's topology.h and add the
SD_ASYM_CPU_POWER flag, which will cause ppc_md.cpu_power() to be
invoked (via arch_cpu_power()) during sched domain initialization.
Signed-off-by: Nathan Lynch <ntl@pobox.com>
---
arch/powerpc/kernel/setup-common.c | 7 +++++++
include/asm-powerpc/machdep.h | 2 ++
include/asm-powerpc/topology.h | 31 +++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index db540ea..609d09e 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -671,3 +671,10 @@ static int powerpc_debugfs_init(void)
}
arch_initcall(powerpc_debugfs_init);
#endif
+
+unsigned int arch_cpu_power(int cpu, unsigned int default_power)
+{
+ if (ppc_md.cpu_power)
+ return ppc_md.cpu_power(cpu, default_power);
+ return default_power;
+}
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 54ed64d..de6ff6b 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -260,6 +260,8 @@ struct machdep_calls {
void (*suspend_disable_irqs)(void);
void (*suspend_enable_irqs)(void);
#endif
+ /* Override scheduler's cpu power calculation */
+ unsigned int (*cpu_power)(int cpu, unsigned int default_power);
};
extern void power4_idle(void);
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h
index 100c6fb..4335c15 100644
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -72,6 +72,37 @@ static inline int pcibus_to_node(struct pci_bus *bus)
.nr_balance_failed = 0, \
}
+#define SD_SIBLING_INIT (struct sched_domain) { \
+ .span = CPU_MASK_NONE, \
+ .parent = NULL, \
+ .child = NULL, \
+ .groups = NULL, \
+ .min_interval = 1, \
+ .max_interval = 2, \
+ .busy_factor = 64, \
+ .imbalance_pct = 110, \
+ .cache_nice_tries = 0, \
+ .busy_idx = 0, \
+ .idle_idx = 0, \
+ .newidle_idx = 0, \
+ .wake_idx = 0, \
+ .forkexec_idx = 0, \
+ .flags = SD_LOAD_BALANCE \
+ | SD_BALANCE_NEWIDLE \
+ | SD_BALANCE_FORK \
+ | SD_BALANCE_EXEC \
+ | SD_WAKE_AFFINE \
+ | SD_WAKE_IDLE \
+ | SD_SHARE_CPUPOWER \
+ | SD_ASYM_CPU_POWER, \
+ .last_balance = jiffies, \
+ .balance_interval = 1, \
+ .nr_balance_failed = 0, \
+}
+
+#define arch_cpu_power(cpu, power) arch_cpu_power(cpu, power)
+extern unsigned int arch_cpu_power(int cpu, unsigned int default_power);
+
extern void __init dump_numa_cpu_topology(void);
extern int sysfs_add_device_to_node(struct sys_device *dev, int nid);
--
1.5.5
WARNING: multiple messages have this Message-ID (diff)
From: Nathan Lynch <ntl@pobox.com>
To: linux-kernel@vger.kernel.org
Cc: linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>,
Ingo Molnar <mingo@elte.hu>, Anton Blanchard <anton@samba.org>
Subject: [RFC/PATCH 2/3] add cpu_power to machdep_calls, override SD_SIBLING_INIT
Date: Wed, 18 Jun 2008 19:29:33 -0500 [thread overview]
Message-ID: <1213835374-10868-3-git-send-email-ntl@pobox.com> (raw)
In-Reply-To: <1213835374-10868-1-git-send-email-ntl@pobox.com>
Add a cpu_power() call to machdep_calls, which will allow platforms to
override the scheduler's default cpu power calculation. If the
platform does not provide a cpu_power() method, the scheduler's
default value is used.
Copy the default SD_SIBLING_INIT to powerpc's topology.h and add the
SD_ASYM_CPU_POWER flag, which will cause ppc_md.cpu_power() to be
invoked (via arch_cpu_power()) during sched domain initialization.
Signed-off-by: Nathan Lynch <ntl@pobox.com>
---
arch/powerpc/kernel/setup-common.c | 7 +++++++
include/asm-powerpc/machdep.h | 2 ++
include/asm-powerpc/topology.h | 31 +++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index db540ea..609d09e 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -671,3 +671,10 @@ static int powerpc_debugfs_init(void)
}
arch_initcall(powerpc_debugfs_init);
#endif
+
+unsigned int arch_cpu_power(int cpu, unsigned int default_power)
+{
+ if (ppc_md.cpu_power)
+ return ppc_md.cpu_power(cpu, default_power);
+ return default_power;
+}
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 54ed64d..de6ff6b 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -260,6 +260,8 @@ struct machdep_calls {
void (*suspend_disable_irqs)(void);
void (*suspend_enable_irqs)(void);
#endif
+ /* Override scheduler's cpu power calculation */
+ unsigned int (*cpu_power)(int cpu, unsigned int default_power);
};
extern void power4_idle(void);
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h
index 100c6fb..4335c15 100644
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -72,6 +72,37 @@ static inline int pcibus_to_node(struct pci_bus *bus)
.nr_balance_failed = 0, \
}
+#define SD_SIBLING_INIT (struct sched_domain) { \
+ .span = CPU_MASK_NONE, \
+ .parent = NULL, \
+ .child = NULL, \
+ .groups = NULL, \
+ .min_interval = 1, \
+ .max_interval = 2, \
+ .busy_factor = 64, \
+ .imbalance_pct = 110, \
+ .cache_nice_tries = 0, \
+ .busy_idx = 0, \
+ .idle_idx = 0, \
+ .newidle_idx = 0, \
+ .wake_idx = 0, \
+ .forkexec_idx = 0, \
+ .flags = SD_LOAD_BALANCE \
+ | SD_BALANCE_NEWIDLE \
+ | SD_BALANCE_FORK \
+ | SD_BALANCE_EXEC \
+ | SD_WAKE_AFFINE \
+ | SD_WAKE_IDLE \
+ | SD_SHARE_CPUPOWER \
+ | SD_ASYM_CPU_POWER, \
+ .last_balance = jiffies, \
+ .balance_interval = 1, \
+ .nr_balance_failed = 0, \
+}
+
+#define arch_cpu_power(cpu, power) arch_cpu_power(cpu, power)
+extern unsigned int arch_cpu_power(int cpu, unsigned int default_power);
+
extern void __init dump_numa_cpu_topology(void);
extern int sysfs_add_device_to_node(struct sys_device *dev, int nid);
--
1.5.5
next prev parent reply other threads:[~2008-06-19 0:30 UTC|newest]
Thread overview: 20+ 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
2008-06-19 0:29 ` [RFC/PATCH 1/3] sched: support arch override of sched_group " Nathan Lynch
2008-06-19 0:29 ` 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 0:29 ` Nathan Lynch
2008-06-19 2:58 ` Olof Johansson
2008-06-19 2:58 ` Olof Johansson
2008-06-19 3:03 ` 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 9:50 ` Ingo Molnar
2008-06-19 17:09 ` Nathan Lynch
2008-06-19 17:09 ` Nathan Lynch
2008-06-26 19:49 ` Breno Leitao
2008-06-26 19:49 ` Breno Leitao
2008-06-27 14:23 ` Nathan Lynch
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-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.