diff options
author | Siddha, Suresh B <suresh.b.siddha@intel.com> | 2006-06-27 05:54:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-27 20:32:45 -0400 |
commit | 5c45bf279d378d436ce45825c0f136696c7b6109 (patch) | |
tree | 80e2fcf4866b84fccb787562e1a83b16f4bc8850 /include | |
parent | 369381694ddcf03f1de403501c8b97099b5109ec (diff) |
[PATCH] sched: mc/smt power savings sched policy
sysfs entries 'sched_mc_power_savings' and 'sched_smt_power_savings' in
/sys/devices/system/cpu/ control the MC/SMT power savings policy for the
scheduler.
Based on the values (1-enable, 0-disable) for these controls, sched groups
cpu power will be determined for different domains. When power savings
policy is enabled and under light load conditions, scheduler will minimize
the physical packages/cpu cores carrying the load and thus conserving
power(with a perf impact based on the workload characteristics... see OLS
2005 CMP kernel scheduler paper for more details..)
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Con Kolivas <kernel@kolivas.org>
Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-i386/topology.h | 5 | ||||
-rw-r--r-- | include/asm-ia64/topology.h | 1 | ||||
-rw-r--r-- | include/asm-powerpc/topology.h | 5 | ||||
-rw-r--r-- | include/asm-sparc64/topology.h | 3 | ||||
-rw-r--r-- | include/asm-x86_64/topology.h | 2 | ||||
-rw-r--r-- | include/linux/sched.h | 10 | ||||
-rw-r--r-- | include/linux/topology.h | 3 |
7 files changed, 28 insertions, 1 deletions
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h index aa4185ee81fb..6adbd9b1ae88 100644 --- a/include/asm-i386/topology.h +++ b/include/asm-i386/topology.h | |||
@@ -112,4 +112,9 @@ extern unsigned long node_remap_size[]; | |||
112 | 112 | ||
113 | extern cpumask_t cpu_coregroup_map(int cpu); | 113 | extern cpumask_t cpu_coregroup_map(int cpu); |
114 | 114 | ||
115 | #ifdef CONFIG_SMP | ||
116 | #define mc_capable() (boot_cpu_data.x86_max_cores > 1) | ||
117 | #define smt_capable() (smp_num_siblings > 1) | ||
118 | #endif | ||
119 | |||
115 | #endif /* _ASM_I386_TOPOLOGY_H */ | 120 | #endif /* _ASM_I386_TOPOLOGY_H */ |
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h index 616b5ed2aa72..937c21257523 100644 --- a/include/asm-ia64/topology.h +++ b/include/asm-ia64/topology.h | |||
@@ -112,6 +112,7 @@ void build_cpu_to_node_map(void); | |||
112 | #define topology_core_id(cpu) (cpu_data(cpu)->core_id) | 112 | #define topology_core_id(cpu) (cpu_data(cpu)->core_id) |
113 | #define topology_core_siblings(cpu) (cpu_core_map[cpu]) | 113 | #define topology_core_siblings(cpu) (cpu_core_map[cpu]) |
114 | #define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) | 114 | #define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) |
115 | #define smt_capable() (smp_num_siblings > 1) | ||
115 | #endif | 116 | #endif |
116 | 117 | ||
117 | #include <asm-generic/topology.h> | 118 | #include <asm-generic/topology.h> |
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h index 92f3e5507d22..bbc3844b086f 100644 --- a/include/asm-powerpc/topology.h +++ b/include/asm-powerpc/topology.h | |||
@@ -93,5 +93,10 @@ static inline void sysfs_remove_device_from_node(struct sys_device *dev, | |||
93 | 93 | ||
94 | #endif /* CONFIG_NUMA */ | 94 | #endif /* CONFIG_NUMA */ |
95 | 95 | ||
96 | #ifdef CONFIG_SMP | ||
97 | #include <asm/cputable.h> | ||
98 | #define smt_capable() (cpu_has_feature(CPU_FTR_SMT)) | ||
99 | #endif | ||
100 | |||
96 | #endif /* __KERNEL__ */ | 101 | #endif /* __KERNEL__ */ |
97 | #endif /* _ASM_POWERPC_TOPOLOGY_H */ | 102 | #endif /* _ASM_POWERPC_TOPOLOGY_H */ |
diff --git a/include/asm-sparc64/topology.h b/include/asm-sparc64/topology.h index 0e234e201bd6..98a6c613589d 100644 --- a/include/asm-sparc64/topology.h +++ b/include/asm-sparc64/topology.h | |||
@@ -1,6 +1,9 @@ | |||
1 | #ifndef _ASM_SPARC64_TOPOLOGY_H | 1 | #ifndef _ASM_SPARC64_TOPOLOGY_H |
2 | #define _ASM_SPARC64_TOPOLOGY_H | 2 | #define _ASM_SPARC64_TOPOLOGY_H |
3 | 3 | ||
4 | #include <asm/spitfire.h> | ||
5 | #define smt_capable() (tlb_type == hypervisor) | ||
6 | |||
4 | #include <asm-generic/topology.h> | 7 | #include <asm-generic/topology.h> |
5 | 8 | ||
6 | #endif /* _ASM_SPARC64_TOPOLOGY_H */ | 9 | #endif /* _ASM_SPARC64_TOPOLOGY_H */ |
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h index c4e46e7fa7ba..6e7a2e976b04 100644 --- a/include/asm-x86_64/topology.h +++ b/include/asm-x86_64/topology.h | |||
@@ -59,6 +59,8 @@ extern int __node_distance(int, int); | |||
59 | #define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id) | 59 | #define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id) |
60 | #define topology_core_siblings(cpu) (cpu_core_map[cpu]) | 60 | #define topology_core_siblings(cpu) (cpu_core_map[cpu]) |
61 | #define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) | 61 | #define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) |
62 | #define mc_capable() (boot_cpu_data.x86_max_cores > 1) | ||
63 | #define smt_capable() (smp_num_siblings > 1) | ||
62 | #endif | 64 | #endif |
63 | 65 | ||
64 | #include <asm-generic/topology.h> | 66 | #include <asm-generic/topology.h> |
diff --git a/include/linux/sched.h b/include/linux/sched.h index ab8ffc54423a..0bc81a151e50 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -570,6 +570,11 @@ enum idle_type | |||
570 | #define SD_WAKE_AFFINE 32 /* Wake task to waking CPU */ | 570 | #define SD_WAKE_AFFINE 32 /* Wake task to waking CPU */ |
571 | #define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */ | 571 | #define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */ |
572 | #define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ | 572 | #define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ |
573 | #define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */ | ||
574 | |||
575 | #define BALANCE_FOR_POWER ((sched_mc_power_savings || sched_smt_power_savings) \ | ||
576 | ? SD_POWERSAVINGS_BALANCE : 0) | ||
577 | |||
573 | 578 | ||
574 | struct sched_group { | 579 | struct sched_group { |
575 | struct sched_group *next; /* Must be a circular list */ | 580 | struct sched_group *next; /* Must be a circular list */ |
@@ -1412,6 +1417,11 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) | |||
1412 | extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); | 1417 | extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); |
1413 | extern long sched_getaffinity(pid_t pid, cpumask_t *mask); | 1418 | extern long sched_getaffinity(pid_t pid, cpumask_t *mask); |
1414 | 1419 | ||
1420 | #include <linux/sysdev.h> | ||
1421 | extern int sched_mc_power_savings, sched_smt_power_savings; | ||
1422 | extern struct sysdev_attribute attr_sched_mc_power_savings, attr_sched_smt_power_savings; | ||
1423 | extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); | ||
1424 | |||
1415 | extern void normalize_rt_tasks(void); | 1425 | extern void normalize_rt_tasks(void); |
1416 | 1426 | ||
1417 | #ifdef CONFIG_PM | 1427 | #ifdef CONFIG_PM |
diff --git a/include/linux/topology.h b/include/linux/topology.h index a305ae2e44b6..ec1eca85290a 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -134,7 +134,8 @@ | |||
134 | .flags = SD_LOAD_BALANCE \ | 134 | .flags = SD_LOAD_BALANCE \ |
135 | | SD_BALANCE_NEWIDLE \ | 135 | | SD_BALANCE_NEWIDLE \ |
136 | | SD_BALANCE_EXEC \ | 136 | | SD_BALANCE_EXEC \ |
137 | | SD_WAKE_AFFINE, \ | 137 | | SD_WAKE_AFFINE \ |
138 | | BALANCE_FOR_POWER, \ | ||
138 | .last_balance = jiffies, \ | 139 | .last_balance = jiffies, \ |
139 | .balance_interval = 1, \ | 140 | .balance_interval = 1, \ |
140 | .nr_balance_failed = 0, \ | 141 | .nr_balance_failed = 0, \ |