* [PATCH RESEND] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap
@ 2016-06-05 16:57 Denys Vlasenko
2016-06-06 8:27 ` Peter Zijlstra
0 siblings, 1 reply; 2+ messages in thread
From: Denys Vlasenko @ 2016-06-05 16:57 UTC (permalink / raw)
To: Ingo Molnar
Cc: Denys Vlasenko, Rafael J . Wysocki, Bartosz Golaszewski,
H . Peter Anvin, Benoit Cousson, Fenghua Yu, Guenter Roeck,
Jean Delvare, Jonathan Corbet, Peter Zijlstra, Thomas Gleixner,
x86, linux-kernel
Straigntforward conversion from
int has_N44_O17_errata[NR_CPUS]
to
DECLARE_BITMAP(has_N44_O17_errata, NR_CPUS)
Saves about 2 kbytes in bss for NR_CPUS=512.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
CC: Rafael J. Wysocki <rjw@rjwysocki.net>
CC: Ingo Molnar <mingo@kernel.org>
CC: Bartosz Golaszewski <bgolaszewski@baylibre.com>
CC: H. Peter Anvin <hpa@zytor.com>
CC: Benoit Cousson <bcousson@baylibre.com>
CC: Fenghua Yu <fenghua.yu@intel.com>
CC: Guenter Roeck <linux@roeck-us.net>
CC: Jean Delvare <jdelvare@suse.de>
CC: Jonathan Corbet <corbet@lwn.net>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: x86@kernel.org
CC: linux-kernel@vger.kernel.org
---
drivers/cpufreq/p4-clockmod.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c
index 5dd95da..dd15810 100644
--- a/drivers/cpufreq/p4-clockmod.c
+++ b/drivers/cpufreq/p4-clockmod.c
@@ -49,7 +49,7 @@ enum {
#define DC_ENTRIES 8
-static int has_N44_O17_errata[NR_CPUS];
+static DECLARE_BITMAP(has_N44_O17_errata, NR_CPUS);
static unsigned int stock_freq;
static struct cpufreq_driver p4clockmod_driver;
static unsigned int cpufreq_p4_get(unsigned int cpu);
@@ -66,7 +66,7 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
if (l & 0x01)
pr_debug("CPU#%d currently thermal throttled\n", cpu);
- if (has_N44_O17_errata[cpu] &&
+ if (test_bit(cpu, has_N44_O17_errata) &&
(newstate == DC_25PT || newstate == DC_DFLT))
newstate = DC_38PT;
@@ -182,7 +182,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
case 0x0f0a:
case 0x0f11:
case 0x0f12:
- has_N44_O17_errata[policy->cpu] = 1;
+ set_bit(policy->cpu, has_N44_O17_errata);
pr_debug("has errata -- disabling low frequencies\n");
}
@@ -199,7 +199,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
/* table init */
for (i = 1; (p4clockmod_table[i].frequency != CPUFREQ_TABLE_END); i++) {
- if ((i < 2) && (has_N44_O17_errata[policy->cpu]))
+ if ((i < 2) && test_bit(policy->cpu, has_N44_O17_errata))
p4clockmod_table[i].frequency = CPUFREQ_ENTRY_INVALID;
else
p4clockmod_table[i].frequency = (stock_freq * i)/8;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap
2016-06-05 16:57 [PATCH RESEND] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap Denys Vlasenko
@ 2016-06-06 8:27 ` Peter Zijlstra
0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2016-06-06 8:27 UTC (permalink / raw)
To: Denys Vlasenko
Cc: Ingo Molnar, Rafael J . Wysocki, Bartosz Golaszewski,
H . Peter Anvin, Benoit Cousson, Fenghua Yu, Guenter Roeck,
Jean Delvare, Jonathan Corbet, Thomas Gleixner, x86,
linux-kernel
On Sun, Jun 05, 2016 at 06:57:33PM +0200, Denys Vlasenko wrote:
> Straigntforward conversion from
> int has_N44_O17_errata[NR_CPUS]
> to
> DECLARE_BITMAP(has_N44_O17_errata, NR_CPUS)
>
> Saves about 2 kbytes in bss for NR_CPUS=512.
Using cpumask_var_t would save even more bytes. Or making it a single
global variables even more.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-06 8:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-05 16:57 [PATCH RESEND] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap Denys Vlasenko
2016-06-06 8:27 ` Peter Zijlstra
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).