Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1233196 > unrolled thread

[PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap

Started byDenys Vlasenko <dvlasenk@redhat.com>
First post2015-09-26 14:50 +0200
Last post2015-09-28 09:20 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap Denys Vlasenko <dvlasenk@redhat.com> - 2015-09-26 14:50 +0200
    Re: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS]  with bitmap Viresh Kumar <viresh.kumar@linaro.org> - 2015-09-27 00:10 +0200
    Re: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS]  with bitmap Jean Delvare <jdelvare@suse.de> - 2015-09-27 18:20 +0200
      Re: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS]  with bitmap Denys Vlasenko <dvlasenk@redhat.com> - 2015-09-27 20:00 +0200
        Re: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS]  with bitmap Jean Delvare <jdelvare@suse.de> - 2015-09-28 09:20 +0200

#1233196 — [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap

FromDenys Vlasenko <dvlasenk@redhat.com>
Date2015-09-26 14:50 +0200
Subject[PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap
Message-ID<qcX5o-dn-11@gated-at.bofh.it>
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>
CC: 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1233549 — Re: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap

FromViresh Kumar <viresh.kumar@linaro.org>
Date2015-09-27 00:10 +0200
SubjectRe: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap
Message-ID<qd5Pl-4uU-65@gated-at.bofh.it>
In reply to#1233196
On 26-09-15, 14:47, 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.
> 
> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
> CC: 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;

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
-- 
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1233703 — Re: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap

FromJean Delvare <jdelvare@suse.de>
Date2015-09-27 18:20 +0200
SubjectRe: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap
Message-ID<qdmQ9-3Ov-3@gated-at.bofh.it>
In reply to#1233196
Hi Denys,

On Sat, 26 Sep 2015 14:47:18 +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.
> 
> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
> CC: 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;

Looks good, however I think you should #include <linux/bitmap.h> to
avoid build failures in the future or on certain architectures.

-- 
Jean Delvare
SUSE L3 Support
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1233714 — Re: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap

FromDenys Vlasenko <dvlasenk@redhat.com>
Date2015-09-27 20:00 +0200
SubjectRe: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap
Message-ID<qdooW-5T3-3@gated-at.bofh.it>
In reply to#1233703
On 09/27/2015 06:10 PM, Jean Delvare wrote:
> Looks good, however I think you should #include <linux/bitmap.h> to
> avoid build failures in the future or on certain architectures.

<linux/cpumask.h> already includes <linux/bitmap.h>
on any arch.

p4-clockmod.c builds only on x86 arch, it's Pentium 4
on demand clock modulation/speed scaling module.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1233906 — Re: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap

FromJean Delvare <jdelvare@suse.de>
Date2015-09-28 09:20 +0200
SubjectRe: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap
Message-ID<qdAT7-7af-1@gated-at.bofh.it>
In reply to#1233714
On Sun, 27 Sep 2015 19:58:11 +0200, Denys Vlasenko wrote:
> On 09/27/2015 06:10 PM, Jean Delvare wrote:
> > Looks good, however I think you should #include <linux/bitmap.h> to
> > avoid build failures in the future or on certain architectures.
> 
> <linux/cpumask.h> already includes <linux/bitmap.h>
> on any arch.

Today it does. Tomorrow, who knows.

> p4-clockmod.c builds only on x86 arch, it's Pentium 4
> on demand clock modulation/speed scaling module.

That is a valid point. My comment was generic, I did not pay attention
to the specific driver.

-- 
Jean Delvare
SUSE L3 Support
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web