linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyen Xuan Hoang" <jerry.nguyen@serialsystem.com.sg>
To: <linuxppc-embedded@lists.linuxppc.org>
Subject: detect idle and suspend the CPU
Date: Thu, 15 Mar 2001 14:30:44 -0800	[thread overview]
Message-ID: <001a01c0ad9f$9311da80$ef0fa8c0@mystore> (raw)
In-Reply-To: 20010314193402.C5558@ecam.san.rr.com


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/

      reply	other threads:[~2001-03-15 22:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-14 22:53 Walnut 405GP and a 3com 905 andrew may
2001-03-15  3:34 ` Walnut 405GP and a 3com 905 (PCI slot0 J31) andrew may
2001-03-15 22:30   ` Nguyen Xuan Hoang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001a01c0ad9f$9311da80$ef0fa8c0@mystore' \
    --to=jerry.nguyen@serialsystem.com.sg \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).