All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ondemand governor clean-ups
@ 2005-02-06 23:06 Eric Piel
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Piel @ 2005-02-06 23:06 UTC (permalink / raw)
  To: Venkatesh Pallipadi, Jun Nakajima; +Cc: cpufreq

[-- Attachment #1: Type: text/plain, Size: 421 bytes --]

Hello,

Having a look at the ondemand governor I noticed some possible trivial 
and minimal clean-ups.

Here they are:
- change from sampling_rate_in_HZ() to the official function 
usecs_to_jiffies().
- use for_each_online_cpu() to instead of using "if (cpu_online(i))"

Those are just trivial clean-ups, please apply,
Eric
--
Trivial ondemand governor clean-ups

Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
--

[-- Attachment #2: ondemand-cleanup-macro-2.6.11-rc3.patch --]
[-- Type: text/x-patch, Size: 1623 bytes --]

--- linux-2.6.11-rc3/drivers/cpufreq/cpufreq_ondemand.c.bak	2005-02-06 23:35:41.000000000 +0100
+++ linux-2.6.11-rc3/drivers/cpufreq/cpufreq_ondemand.c	2005-02-06 23:37:15.000000000 +0100
@@ -281,7 +281,7 @@ static void dbs_check_cpu(int cpu)
 	/* Scale idle ticks by 100 and compare with up and down ticks */
 	idle_ticks *= 100;
 	up_idle_ticks = (100 - dbs_tuners_ins.up_threshold) *
-			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate);
+			usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
 
 	if (idle_ticks < up_idle_ticks) {
 		__cpufreq_driver_target(policy, policy->max, 
@@ -328,7 +328,7 @@ static void dbs_check_cpu(int cpu)
 	freq_down_sampling_rate = dbs_tuners_ins.sampling_rate *
 		dbs_tuners_ins.sampling_down_factor;
 	down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) *
-			sampling_rate_in_HZ(freq_down_sampling_rate);
+			usecs_to_jiffies(freq_down_sampling_rate);
 
 	if (idle_ticks > down_idle_ticks ) {
 		freq_down_step = (5 * policy->max) / 100;
@@ -348,11 +348,10 @@ static void do_dbs_timer(void *data)
 { 
 	int i;
 	down(&dbs_sem);
-	for (i = 0; i < NR_CPUS; i++)
-		if (cpu_online(i))
-			dbs_check_cpu(i);
+	for_each_online_cpu(i)
+		dbs_check_cpu(i);
 	schedule_delayed_work(&dbs_work, 
-			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate));
+			usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
 	up(&dbs_sem);
 } 
 
@@ -360,7 +359,7 @@ static inline void dbs_timer_init(void)
 {
 	INIT_WORK(&dbs_work, do_dbs_timer, NULL);
 	schedule_delayed_work(&dbs_work,
-			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate));
+			usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
 	return;
 }
 

[-- Attachment #3: Type: text/plain, Size: 147 bytes --]

_______________________________________________
Cpufreq mailing list
Cpufreq@lists.linux.org.uk
http://lists.linux.org.uk/mailman/listinfo/cpufreq

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] ondemand governor clean-ups
@ 2005-02-07 18:47 Pallipadi, Venkatesh
  2005-02-07 21:03 ` Eric Piel
  0 siblings, 1 reply; 4+ messages in thread
From: Pallipadi, Venkatesh @ 2005-02-07 18:47 UTC (permalink / raw)
  To: Eric Piel, Nakajima, Jun; +Cc: cpufreq

 

Hi,

Thanks for the patch. Looks good. Can you also remove the #define for
sampling_rate_in_HZ, as it is no longer required.

Thanks,
Venki

>-----Original Message-----
>From: Eric Piel [mailto:Eric.Piel@tremplin-utc.net] 
>Sent: Sunday, February 06, 2005 3:06 PM
>To: Pallipadi, Venkatesh; Nakajima, Jun
>Cc: cpufreq@ZenII.linux.org.uk
>Subject: [PATCH] ondemand governor clean-ups
>
>Hello,
>
>Having a look at the ondemand governor I noticed some possible trivial 
>and minimal clean-ups.
>
>Here they are:
>- change from sampling_rate_in_HZ() to the official function 
>usecs_to_jiffies().
>- use for_each_online_cpu() to instead of using "if (cpu_online(i))"
>
>Those are just trivial clean-ups, please apply,
>Eric
>--
>Trivial ondemand governor clean-ups
>
>Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
>--
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ondemand governor clean-ups
  2005-02-07 18:47 Pallipadi, Venkatesh
@ 2005-02-07 21:03 ` Eric Piel
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Piel @ 2005-02-07 21:03 UTC (permalink / raw)
  To: Pallipadi, Venkatesh; +Cc: cpufreq, Nakajima, Jun

[-- Attachment #1: Type: text/plain, Size: 972 bytes --]

Pallipadi, Venkatesh wrote:
>  
> 
> Hi,
> 
> Thanks for the patch. Looks good. Can you also remove the #define for
> sampling_rate_in_HZ, as it is no longer required.
Oops, I had done it but it went wrong when doing the patch. My second 
tried is attached :-)

Eric
> 
>>-----Original Message-----
>>From: Eric Piel [mailto:Eric.Piel@tremplin-utc.net] 
>>Sent: Sunday, February 06, 2005 3:06 PM
>>To: Pallipadi, Venkatesh; Nakajima, Jun
>>Cc: cpufreq@ZenII.linux.org.uk
>>Subject: [PATCH] ondemand governor clean-ups
>>
>>Hello,
>>
>>Having a look at the ondemand governor I noticed some possible trivial 
>>and minimal clean-ups.
>>
>>Here they are:
>>- change from sampling_rate_in_HZ() to the official function 
>>usecs_to_jiffies().
>>- use for_each_online_cpu() to instead of using "if (cpu_online(i))"
>>
>>Those are just trivial clean-ups, please apply,
>>Eric
Oops,
--
Trivial ondemand governor clean-ups

Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
--

[-- Attachment #2: ondemand-cleanup-macro-2.6.11-rc3.patch --]
[-- Type: text/x-patch, Size: 1957 bytes --]

--- linux-2.6.11-rc3/drivers/cpufreq/cpufreq_ondemand.c.bak	2005-02-06 23:35:41.000000000 +0100
+++ linux-2.6.11-rc3/drivers/cpufreq/cpufreq_ondemand.c	2005-02-07 21:45:18.000000000 +0100
@@ -57,7 +57,6 @@ static unsigned int 				def_sampling_rat
 #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER	(1000)
 #define DEF_SAMPLING_DOWN_FACTOR		(10)
 #define TRANSITION_LATENCY_LIMIT		(10 * 1000)
-#define sampling_rate_in_HZ(x)			(((x * HZ) < (1000 * 1000))?1:((x * HZ) / (1000 * 1000)))
 
 static void do_dbs_timer(void *data);
 
@@ -281,7 +280,7 @@ static void dbs_check_cpu(int cpu)
 	/* Scale idle ticks by 100 and compare with up and down ticks */
 	idle_ticks *= 100;
 	up_idle_ticks = (100 - dbs_tuners_ins.up_threshold) *
-			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate);
+			usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
 
 	if (idle_ticks < up_idle_ticks) {
 		__cpufreq_driver_target(policy, policy->max, 
@@ -328,7 +327,7 @@ static void dbs_check_cpu(int cpu)
 	freq_down_sampling_rate = dbs_tuners_ins.sampling_rate *
 		dbs_tuners_ins.sampling_down_factor;
 	down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) *
-			sampling_rate_in_HZ(freq_down_sampling_rate);
+			usecs_to_jiffies(freq_down_sampling_rate);
 
 	if (idle_ticks > down_idle_ticks ) {
 		freq_down_step = (5 * policy->max) / 100;
@@ -348,11 +347,10 @@ static void do_dbs_timer(void *data)
 { 
 	int i;
 	down(&dbs_sem);
-	for (i = 0; i < NR_CPUS; i++)
-		if (cpu_online(i))
-			dbs_check_cpu(i);
+	for_each_online_cpu(i)
+		dbs_check_cpu(i);
 	schedule_delayed_work(&dbs_work, 
-			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate));
+			usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
 	up(&dbs_sem);
 } 
 
@@ -360,7 +358,7 @@ static inline void dbs_timer_init(void)
 {
 	INIT_WORK(&dbs_work, do_dbs_timer, NULL);
 	schedule_delayed_work(&dbs_work,
-			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate));
+			usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
 	return;
 }
 

[-- Attachment #3: Type: text/plain, Size: 147 bytes --]

_______________________________________________
Cpufreq mailing list
Cpufreq@lists.linux.org.uk
http://lists.linux.org.uk/mailman/listinfo/cpufreq

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] ondemand governor clean-ups
@ 2005-02-07 21:15 Pallipadi, Venkatesh
  0 siblings, 0 replies; 4+ messages in thread
From: Pallipadi, Venkatesh @ 2005-02-07 21:15 UTC (permalink / raw)
  To: davej, Dominik Brodowski; +Cc: cpufreq, Eric Piel

[-- Attachment #1: Type: text/plain, Size: 371 bytes --]

 
Thanks.
Dave/Dominik: Please Apply.

- Venki

Trivial ondemand governor clean-ups:
- change from sampling_rate_in_HZ() to the official function 
usecs_to_jiffies().
- use for_each_online_cpu() to instead of using "if (cpu_online(i))"

Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>

[-- Attachment #2: ondemand-cleanup-macro-2.6.11-rc3.patch --]
[-- Type: application/octet-stream, Size: 2009 bytes --]

--- linux-2.6.11-rc3/drivers/cpufreq/cpufreq_ondemand.c.bak	2005-02-06 23:35:41.000000000 +0100
+++ linux-2.6.11-rc3/drivers/cpufreq/cpufreq_ondemand.c	2005-02-07 21:45:18.000000000 +0100
@@ -57,7 +57,6 @@ static unsigned int 				def_sampling_rat
 #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER	(1000)
 #define DEF_SAMPLING_DOWN_FACTOR		(10)
 #define TRANSITION_LATENCY_LIMIT		(10 * 1000)
-#define sampling_rate_in_HZ(x)			(((x * HZ) < (1000 * 1000))?1:((x * HZ) / (1000 * 1000)))
 
 static void do_dbs_timer(void *data);
 
@@ -281,7 +280,7 @@ static void dbs_check_cpu(int cpu)
 	/* Scale idle ticks by 100 and compare with up and down ticks */
 	idle_ticks *= 100;
 	up_idle_ticks = (100 - dbs_tuners_ins.up_threshold) *
-			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate);
+			usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
 
 	if (idle_ticks < up_idle_ticks) {
 		__cpufreq_driver_target(policy, policy->max, 
@@ -328,7 +327,7 @@ static void dbs_check_cpu(int cpu)
 	freq_down_sampling_rate = dbs_tuners_ins.sampling_rate *
 		dbs_tuners_ins.sampling_down_factor;
 	down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) *
-			sampling_rate_in_HZ(freq_down_sampling_rate);
+			usecs_to_jiffies(freq_down_sampling_rate);
 
 	if (idle_ticks > down_idle_ticks ) {
 		freq_down_step = (5 * policy->max) / 100;
@@ -348,11 +347,10 @@ static void do_dbs_timer(void *data)
 { 
 	int i;
 	down(&dbs_sem);
-	for (i = 0; i < NR_CPUS; i++)
-		if (cpu_online(i))
-			dbs_check_cpu(i);
+	for_each_online_cpu(i)
+		dbs_check_cpu(i);
 	schedule_delayed_work(&dbs_work, 
-			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate));
+			usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
 	up(&dbs_sem);
 } 
 
@@ -360,7 +358,7 @@ static inline void dbs_timer_init(void)
 {
 	INIT_WORK(&dbs_work, do_dbs_timer, NULL);
 	schedule_delayed_work(&dbs_work,
-			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate));
+			usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
 	return;
 }
 

[-- Attachment #3: Type: text/plain, Size: 147 bytes --]

_______________________________________________
Cpufreq mailing list
Cpufreq@lists.linux.org.uk
http://lists.linux.org.uk/mailman/listinfo/cpufreq

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-02-07 21:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-06 23:06 [PATCH] ondemand governor clean-ups Eric Piel
  -- strict thread matches above, loose matches on Subject: below --
2005-02-07 18:47 Pallipadi, Venkatesh
2005-02-07 21:03 ` Eric Piel
2005-02-07 21:15 Pallipadi, Venkatesh

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.