Skip to contentSkip to conversation

driver or calculation of load average wrong ?

DISCUSSION Frank Salomon 3 participants 3 messages Oct 11, 2010

lore
Share & tools
lore
#0 lore raw

Hello All,

I have the following configuration:
- CentOS 5
- kernel 2.6.20.1
- My own driver in a kernel_thread:

		while ( 1 ){
			printk ( KERN_INFO "go sleep, %lu\n", jiffies );
			current -> state = TASK_UNINTERRUPTIBLE;
			schedule_timeout ( msecs_to_jiffies(4000) );
			printk ( KERN_INFO "wakeup, %lu\n", jiffies );
		}

Each time I load the driver, the load average in /proc/loadavg reached:

	$ cat /proc/loadavg
	0.99 0.62 0.26 1/47 2868
Without my driver:
	$ cat /proc/loadavg
	0.03 0.03 0.00 1/47 2867

I changed nr_active(void) in kernel/sched.c:
unsigned long nr_active(void)

{
         unsigned long i, running = 0, uninterruptible = 0;

         for_each_online_cpu(i) {
                 running += cpu_rq(i)->nr_running;
                 uninterruptible += cpu_rq(i)->nr_uninterruptible;
         }

         if (unlikely((long)uninterruptible < 0))
                 uninterruptible = 0;
// original:     return running + uninterruptible;
         return running;
}

Driver loaded or not:

	$ cat /proc/loadavg
	0.03 0.03 0.00 1/47 2867

Any help or comments would be really great?

Best regards, thanks, Frank

Signature · 25 lines
WINCOR NIXDORF International GmbH
Retail Store Solutions
Heinz-Nixdorf-Ring 1
33106 Paderborn
Tel. +49 (0) 30 5017 1335
Fax +49 (0) 30 5017 1305
mail [email protected]


WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Dr. Jürgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193

Diese E-Mail enthält vertrauliche Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.

This e-mail may contain confidential information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
#1 lore raw
Quoted 6 lines · Frank Salomon

I have the following configuration:
- CentOS 5
- kernel 2.6.20.1
- My own driver in a kernel_thread:

Quoted 31 lines

[snipped NDA'd information]

Any help or comments would be really great?

Best regards, thanks, Frank

Signature · 24 lines
WINCOR NIXDORF International GmbH
Retail Store Solutions
Heinz-Nixdorf-Ring 1
33106 Paderborn
Tel. +49 (0) 30 5017 1335
Fax +49 (0) 30 5017 1305
mail [email protected]

WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Dr. Jürgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193

Diese E-Mail enthält vertrauliche Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.

This e-mail may contain confidential information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

...alas I have to consult with my lawyer before being able to help.

Cheers

Signature · 3 lines
Alexander Clouter
.sigmonster says: BOFH excuse #153:
                  Big to little endian conversion error
#2 lore raw
In reply to Frank Salomon
Quoted 10 lines · Frank Salomon

Hello All,

I have the following configuration:
- CentOS 5
- kernel 2.6.20.1
- My own driver in a kernel_thread:

		while ( 1 ){
			printk ( KERN_INFO "go sleep, %lu\n", jiffies );
			current -> state = TASK_UNINTERRUPTIBLE;
			schedule_timeout ( msecs_to_jiffies(4000) );

Change this to schedule_timeout_interruptable() and your load average calculation will go back to what you expect it to.

hope this helps,

greg k-h