Skip to contentSkip to conversation

cpufreq_conservative: invert meaning of 'ignore_nice'

PATCH In review Alexander Clouter 4 participants 5 messages Sep 29, 2005 – Sep 30, 2005 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq_conservative: invert meaning of 'ignore_nice'

The use of the 'ignore_nice' sysfs file is confusing to anyone using. This patch makes it so when you now set it to the default value of 1, process nice time is also ignored in the cpu 'busyness' calculation.

Prior to this patch to set it to '1' to make process nice time count...even confused me :)

WARNING: this obvious breaks any userland tools that expect things to be the other way round. This patch clears up the confusion but should go in ASAP as at the moment it seems very few tools even make use of this functionality; all I could find was a Gentoo Wiki entry.

drivers/cpufreq/cpufreq_conservative.c +2 -2
diff -u linux-2.6.13.orig/drivers/cpufreq/cpufreq_conservative.c linux-2.6.13/drivers/cpufreq/cpufreq_conservative.c
@@ -93,7 +93,7 @@
 {
 	return	kstat_cpu(cpu).cpustat.idle +
 		kstat_cpu(cpu).cpustat.iowait +
-		( !dbs_tuners_ins.ignore_nice ? 
+		( dbs_tuners_ins.ignore_nice ? 
 		  kstat_cpu(cpu).cpustat.nice :
 		  0);
 }
@@ -515,7 +515,7 @@
 			def_sampling_rate = (latency / 1000) *
 					DEF_SAMPLING_RATE_LATENCY_MULTIPLIER;
 			dbs_tuners_ins.sampling_rate = def_sampling_rate;
-			dbs_tuners_ins.ignore_nice = 0;
+			dbs_tuners_ins.ignore_nice = 1;
 			dbs_tuners_ins.freq_step = 5;
 
 			dbs_timer_init();
drivers/cpufreq/cpufreq_ondemand.c +2 -2
diff -u linux-2.6.13.orig/drivers/cpufreq/cpufreq_ondemand.c linux-2.6.13/drivers/cpufreq/cpufreq_ondemand.c
@@ -86,7 +86,7 @@
 {
 	return	kstat_cpu(cpu).cpustat.idle +
 		kstat_cpu(cpu).cpustat.iowait +
-		( !dbs_tuners_ins.ignore_nice ? 
+		( dbs_tuners_ins.ignore_nice ? 
 		  kstat_cpu(cpu).cpustat.nice :
 		  0);
 }
@@ -424,7 +424,7 @@
 			def_sampling_rate = (latency / 1000) *
 					DEF_SAMPLING_RATE_LATENCY_MULTIPLIER;
 			dbs_tuners_ins.sampling_rate = def_sampling_rate;
-			dbs_tuners_ins.ignore_nice = 0;
+			dbs_tuners_ins.ignore_nice = 1;
 
 			dbs_timer_init();
 		}
#1 lore raw
Quoted 11 lines · Alexander Clouter

The use of the 'ignore_nice' sysfs file is confusing to anyone using. This patch makes it so when you now set it to the default value of 1, process nice time is also ignored in the cpu 'busyness' calculation.

Prior to this patch to set it to '1' to make process nice time count...even confused me :)

WARNING: this obvious breaks any userland tools that expect things to be the other way round. This patch clears up the confusion but should go in ASAP as at the moment it seems very few tools even make use of this functionality; all I could find was a Gentoo Wiki entry.

My suggestion on this is to rename the flag too, as ignore_nice_load (or ignore_nice_tasks, choose your way). Don't forget to do it in docs too.

So userspace tools will error out rather than do the reverse of what they were doing, and the user will fix the thing according to the (new) docs.

This is the way we avoid problems in kernel code, when changing APIs (I read Linus talking about this), so I assume it's ok?

Signature · 12 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade


	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it
#2 lore raw
Quoted 13 lines · Blaisorblade
Quoted 11 lines · Alexander Clouter

The use of the 'ignore_nice' sysfs file is confusing to anyone using. This patch makes it so when you now set it to the default value of 1, process nice time is also ignored in the cpu 'busyness' calculation.

Prior to this patch to set it to '1' to make process nice time count...even confused me :)

WARNING: this obvious breaks any userland tools that expect things to be the other way round. This patch clears up the confusion but should go in ASAP as at the moment it seems very few tools even make use of this functionality; all I could find was a Gentoo Wiki entry.

Quoted 5 lines

My suggestion on this is to rename the flag too, as ignore_nice_load (or ignore_nice_tasks, choose your way). Don't forget to do it in docs too.

So userspace tools will error out rather than do the reverse of what they were doing, and the user will fix the thing according to the (new) docs.

Agreed. If we change this, we change it completely. Stefan already mentioned his app will break, and we typically don't find out about widespread breakage until after we ship a release.

Dave

#3 lore raw
Quoted 8 lines · Dave Jones
Quoted 2 lines · Blaisorblade

So userspace tools will error out rather than do the reverse of what they were doing, and the user will fix the thing according to the (new) docs.

Agreed. If we change this, we change it completely. Stefan already mentioned his app will break, and we typically don't find out about widespread breakage until after we ship a release.

I can live with the change - powersaved has a setting "consider_nice" to configure this and i can put out a support article telling people to "invert" this setting if they are running custom kernels, so it is not really a showstopper for me. Most of the users don't understand thos settings anyway ;-)

I'm not sure what is better for me - a nice short name or a clear indication on which version we are running ;-)

Signature · 3 lines
Stefan Seyfried                  \ "I didn't want to write for pay. I
QA / R&D Team Mobile Devices      \ wanted to be paid for what I write."
SUSE LINUX Products GmbH, Nürnberg \                    -- Leonard Cohen
#4 lore raw
In reply to Blaisorblade

Blaisorblade <[email protected]> [20050929 13:46:33 +0200]:

Quoted 11 lines · Alexander Clouter
Quoted 5 lines

WARNING: this obvious breaks any userland tools that expect things to be the other way round. This patch clears up the confusion but should go in ASAP as at the moment it seems very few tools even make use of this functionality; all I could find was a Gentoo Wiki entry.

My suggestion on this is to rename the flag too, as ignore_nice_load (or ignore_nice_tasks, choose your way). Don't forget to do it in docs too.

'ignore_nice_tasks' gets my vote..

Quoted 6 lines

So userspace tools will error out rather than do the reverse of what they were doing, and the user will fix the thing according to the (new) docs.

This is the way we avoid problems in kernel code, when changing APIs (I read Linus talking about this), so I assume it's ok?

Makes a lot of sense. I'll roll out some new patches this evening and submit them.

Regards

Alex

Quoted 13 lines
Signature · 12 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade


	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it
Signature · 8 lines
 ________________________________________ 
< An idle mind is worth two in the bush. >
 ---------------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

_______________________________________________
Cpufreq mailing list
[email protected]
http://lists.linux.org.uk/mailman/listinfo/cpufreq