detect idle and suspend the CPU
Nguyen Xuan Hoang
jerry.nguyen at serialsystem.com.sg
Fri Mar 16 09:30:44 EST 2001
Hi,
I am writting a code to automatically suspend the CPU (MPC823) and system
after it goes idle a few minutes.
I try to modify the idled() function in /arch/ppc/kernel/idle.c to count if
the CPU running in this code more than 5 minutes without reschedule , so I
will consider it idle.
for(;;)
{
if(work) start_idle = jiffies;
if(jiffies - start_idle > HARD_IDLE_TIMEOUT) {
detect_idle(); // suspend CPU here
}
work = current->need_resched;
__sti();
check_pgt_cache();
....
}
However just after every 20s, the current->need_resched turn on, as a result
I can not detect the system idle (I already kill all process, excepet
init,kupdate,bdflush,sh).
I found out the init will automatically wake up after 20s.
My question is:
1. How the Linux Kernel for PC do this? I can see PC will automatically
suspend after 15 minutes.
2. Where should be the best place to put the suspend code ? (in idled() ?)
3. Is there anyone have implemented this feature for MPC823, where can I get
the information?
Thank in advances
Jerry
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-embedded
mailing list