lkml.org 
[lkml]   [2000]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: kapmd cpu usage
Date
From
Hi Rik,

Rik van Riel <riel@conectiva.com.br> writes:
>
> I have the idea we should really fix this dirty accounting
> thing and properly account kapmd time to idle time.

I got thinking about this and think I went slightly insane :-)

How does the following look ... it makes kapmd equivalent to
the idle processes as far as accounting for time is concerned.
Top looks funny - kapmd is getting 96% of the CPU, but the
CPU is 99.4% idle! :-)

Please tell me if I am crazy ...

Cheers,
Stephen
--
Stephen Rothwell, Open Source Researcher, Linuxcare, Inc.
+61-2-62628990 tel, +61-2-62628991 fax
sfr@linuxcare.com, http://www.linuxcare.com/
Linuxcare. Support for the revolution.

diff -ruN 2.4.0-test9/arch/alpha/kernel/process.c 2.4.0-test9-APM/arch/alpha/kernel/process.c
--- 2.4.0-test9/arch/alpha/kernel/process.c Wed Oct 4 10:36:48 2000
+++ 2.4.0-test9-APM/arch/alpha/kernel/process.c Mon Oct 9 16:03:28 2000
@@ -76,6 +76,7 @@
/* An endless idle loop with no priority at all. */
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;

while (1) {
/* FIXME -- EV6 and LCA45 know how to power down
diff -ruN 2.4.0-test9/arch/arm/kernel/process.c 2.4.0-test9-APM/arch/arm/kernel/process.c
--- 2.4.0-test9/arch/arm/kernel/process.c Wed Oct 4 10:36:59 2000
+++ 2.4.0-test9-APM/arch/arm/kernel/process.c Mon Oct 9 16:04:00 2000
@@ -87,6 +87,7 @@
init_idle();
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;

while (1) {
void (*idle)(void) = pm_idle;
diff -ruN 2.4.0-test9/arch/i386/kernel/apm.c 2.4.0-test9-APM/arch/i386/kernel/apm.c
--- 2.4.0-test9/arch/i386/kernel/apm.c Wed Oct 4 10:36:17 2000
+++ 2.4.0-test9-APM/arch/i386/kernel/apm.c Mon Oct 9 16:15:13 2000
@@ -1426,6 +1426,7 @@
current->files = init_task.files;
atomic_inc(&current->files->count);
daemonize();
+ current->idle_proc = 1;

strcpy(current->comm, "kapmd");
sigfillset(&current->blocked);
diff -ruN 2.4.0-test9/arch/i386/kernel/process.c 2.4.0-test9-APM/arch/i386/kernel/process.c
--- 2.4.0-test9/arch/i386/kernel/process.c Wed Oct 4 10:36:59 2000
+++ 2.4.0-test9-APM/arch/i386/kernel/process.c Mon Oct 9 16:05:42 2000
@@ -125,6 +125,7 @@
init_idle();
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;

while (1) {
void (*idle)(void) = pm_idle;
diff -ruN 2.4.0-test9/arch/ia64/kernel/process.c 2.4.0-test9-APM/arch/ia64/kernel/process.c
--- 2.4.0-test9/arch/ia64/kernel/process.c Wed Oct 4 10:36:34 2000
+++ 2.4.0-test9-APM/arch/ia64/kernel/process.c Mon Oct 9 16:06:23 2000
@@ -121,6 +121,7 @@
init_idle();
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;


while (1) {
diff -ruN 2.4.0-test9/arch/m68k/kernel/process.c 2.4.0-test9-APM/arch/m68k/kernel/process.c
--- 2.4.0-test9/arch/m68k/kernel/process.c Wed Oct 4 10:36:48 2000
+++ 2.4.0-test9-APM/arch/m68k/kernel/process.c Mon Oct 9 16:06:41 2000
@@ -83,6 +83,7 @@
init_idle();
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;
idle();
}

diff -ruN 2.4.0-test9/arch/mips/kernel/process.c 2.4.0-test9-APM/arch/mips/kernel/process.c
--- 2.4.0-test9/arch/mips/kernel/process.c Wed Oct 4 10:36:48 2000
+++ 2.4.0-test9-APM/arch/mips/kernel/process.c Mon Oct 9 16:07:14 2000
@@ -36,6 +36,7 @@
/* endless idle loop with no priority at all */
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;
init_idle();

while (1) {
diff -ruN 2.4.0-test9/arch/mips64/kernel/process.c 2.4.0-test9-APM/arch/mips64/kernel/process.c
--- 2.4.0-test9/arch/mips64/kernel/process.c Wed Oct 4 10:36:48 2000
+++ 2.4.0-test9-APM/arch/mips64/kernel/process.c Mon Oct 9 16:07:43 2000
@@ -35,6 +35,7 @@
init_idle();
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;
while (1) {
while (!current->need_resched)
if (wait_available)
diff -ruN 2.4.0-test9/arch/mips64/sgi-ip27/ip27-timer.c 2.4.0-test9-APM/arch/mips64/sgi-ip27/ip27-timer.c
--- 2.4.0-test9/arch/mips64/sgi-ip27/ip27-timer.c Wed Oct 4 10:37:00 2000
+++ 2.4.0-test9-APM/arch/mips64/sgi-ip27/ip27-timer.c Mon Oct 9 16:14:10 2000
@@ -110,7 +110,7 @@
do_timer(regs);

#ifdef CONFIG_SMP
- if (current->pid) {
+ if (!current->idle_proc) {
unsigned int *inc, *inc2;
int user = user_mode(regs);

diff -ruN 2.4.0-test9/arch/ppc/kernel/idle.c 2.4.0-test9-APM/arch/ppc/kernel/idle.c
--- 2.4.0-test9/arch/ppc/kernel/idle.c Wed Oct 4 10:37:00 2000
+++ 2.4.0-test9-APM/arch/ppc/kernel/idle.c Mon Oct 9 16:08:23 2000
@@ -50,6 +50,7 @@
/* endless loop with no priority at all */
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;
init_idle();
for (;;)
{
diff -ruN 2.4.0-test9/arch/s390/kernel/process.c 2.4.0-test9-APM/arch/s390/kernel/process.c
--- 2.4.0-test9/arch/s390/kernel/process.c Wed Oct 4 10:36:49 2000
+++ 2.4.0-test9-APM/arch/s390/kernel/process.c Mon Oct 9 16:08:58 2000
@@ -61,6 +61,7 @@
init_idle();
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;
wait_psw.mask = _WAIT_PSW_MASK;
wait_psw.addr = (unsigned long) &&idle_wakeup | 0x80000000L;
while(1) {
diff -ruN 2.4.0-test9/arch/s390/kernel/smp.c 2.4.0-test9-APM/arch/s390/kernel/smp.c
--- 2.4.0-test9/arch/s390/kernel/smp.c Wed Oct 4 10:36:49 2000
+++ 2.4.0-test9-APM/arch/s390/kernel/smp.c Mon Oct 9 16:14:40 2000
@@ -706,7 +706,7 @@

irq_enter(cpu, 0);
update_one_process(p, 1, user, system, cpu);
- if (p->pid) {
+ if (!p->idle_proc) {
p->counter -= 1;
if (p->counter <= 0) {
p->counter = 0;
diff -ruN 2.4.0-test9/arch/sh/kernel/process.c 2.4.0-test9-APM/arch/sh/kernel/process.c
--- 2.4.0-test9/arch/sh/kernel/process.c Wed Oct 4 10:37:01 2000
+++ 2.4.0-test9-APM/arch/sh/kernel/process.c Mon Oct 9 16:09:22 2000
@@ -65,6 +65,7 @@
init_idle();
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;

while (1) {
while (!current->need_resched) {
diff -ruN 2.4.0-test9/arch/sparc/kernel/process.c 2.4.0-test9-APM/arch/sparc/kernel/process.c
--- 2.4.0-test9/arch/sparc/kernel/process.c Wed Oct 4 10:36:49 2000
+++ 2.4.0-test9-APM/arch/sparc/kernel/process.c Mon Oct 9 16:10:13 2000
@@ -62,6 +62,7 @@
/* endless idle loop with no priority at all */
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;
init_idle();

for (;;) {
@@ -111,6 +112,7 @@
/* endless idle loop with no priority at all */
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;
init_idle();

while(1) {
diff -ruN 2.4.0-test9/arch/sparc64/kernel/process.c 2.4.0-test9-APM/arch/sparc64/kernel/process.c
--- 2.4.0-test9/arch/sparc64/kernel/process.c Wed Oct 4 10:36:49 2000
+++ 2.4.0-test9-APM/arch/sparc64/kernel/process.c Mon Oct 9 16:10:44 2000
@@ -55,6 +55,7 @@
/* endless idle loop with no priority at all */
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;
init_idle();

for (;;) {
@@ -85,6 +86,7 @@
{
current->nice = 20;
current->counter = -100;
+ current->idle_proc = 1;
init_idle();

while(1) {
diff -ruN 2.4.0-test9/include/linux/sched.h 2.4.0-test9-APM/include/linux/sched.h
--- 2.4.0-test9/include/linux/sched.h Wed Oct 4 10:37:14 2000
+++ 2.4.0-test9-APM/include/linux/sched.h Mon Oct 9 16:18:18 2000
@@ -311,6 +311,7 @@
unsigned long personality;
int dumpable:1;
int did_exec:1;
+ int idle_proc:1;
pid_t pid;
pid_t pgrp;
pid_t tty_old_pgrp;
diff -ruN 2.4.0-test9/kernel/fork.c 2.4.0-test9-APM/kernel/fork.c
--- 2.4.0-test9/kernel/fork.c Wed Oct 4 10:36:53 2000
+++ 2.4.0-test9-APM/kernel/fork.c Mon Oct 9 15:54:06 2000
@@ -579,6 +579,7 @@
__MOD_INC_USE_COUNT(p->binfmt->module);

p->did_exec = 0;
+ p->idle_proc = 0;
p->swappable = 0;
p->state = TASK_UNINTERRUPTIBLE;

diff -ruN 2.4.0-test9/kernel/timer.c 2.4.0-test9-APM/kernel/timer.c
--- 2.4.0-test9/kernel/timer.c Wed Oct 4 10:37:15 2000
+++ 2.4.0-test9-APM/kernel/timer.c Mon Oct 9 16:11:58 2000
@@ -583,7 +583,7 @@
int cpu = smp_processor_id(), system = user_tick ^ 1;

update_one_process(p, user_tick, system, cpu);
- if (p->pid) {
+ if (!p->idle_proc) {
if (--p->counter <= 0) {
p->counter = 0;
p->need_resched = 1;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.136 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site