* Make the following changes to acpi-cpufreq.c functions:
- use node_to_cpumask_ptr in place of node_to_cpumask
- use get_cpumask_var for temporary cpumask_t variables
- use alloc_cpumask_ptr where available
- use a per_cpu temp variable for drv_cmd which contains an
embedded cpumask_t variable.
* The resultant stack savings are:
====== Stack (-l 100)
1 - initial
2 - stack-hogs-acpi-cpufreq_c
'.' is less than the limit(100)
.1. .2. ..final..
1608 -1024 584 -63% acpi_cpufreq_target
1096 -1096 . -100% sched_balance_self
1048 -536 512 -51% get_cur_val
520 -520 . -100% get_measured_perf
Applies to linux-2.6.tip/master.
Signed-off-by: Mike Travis <travis@sgi.com>
---
arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 93 +++++++++++++++++------------
1 file changed, 57 insertions(+), 36 deletions(-)
--- linux-2.6.tip.orig/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ linux-2.6.tip/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -33,6 +33,7 @@
#include <linux/cpufreq.h>
#include <linux/compiler.h>
#include <linux/dmi.h>
+#include <linux/cpumask_ptr.h>
#include <linux/acpi.h>
#include <acpi/processor.h>
@@ -68,6 +69,8 @@ struct acpi_cpufreq_data {
};
static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data);
+static DEFINE_PER_CPU(struct drv_cmd, temp_cmd);
+static DEFINE_PER_CPUMASK(temp_cpumask);
/* acpi_perf_data is a pointer to percpu data. */
static struct acpi_processor_performance *acpi_perf_data;
@@ -214,33 +217,39 @@ static void drv_write(struct drv_cmd *cm
static u32 get_cur_val(const cpumask_t *mask)
{
struct acpi_processor_performance *perf;
- struct drv_cmd cmd;
+ struct drv_cmd *cmd;
+ u32 temp_val;
if (unlikely(cpus_empty(*mask)))
return 0;
+ cmd = &get_cpu_var(temp_cmd);
switch (per_cpu(drv_data, first_cpu(*mask))->cpu_feature) {
case SYSTEM_INTEL_MSR_CAPABLE:
- cmd.type = ...