linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Delio Brignoli" <nordkyn@tin.it>
To: sfr@canb.auug.org.au
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] kapmd improvent?
Date: Thu, 6 Sep 2001 11:42:24 +0200	[thread overview]
Message-ID: <20010906114224.A1468@argo.tin.it> (raw)

The problem:

After a burst of heavy load my system (a laptop) returns idle,
but kapmd isn't scheduled anymore so if I 'top' I can see the system nearly 
100% idle but kampd is consuming 0.0% CPU time.

The explanation:

when kapmd returns from schedule_timeout it checks if system_idle(), 
at this point if there is more than one task running we double 
timeout (clamp it to APM_CHECK_TIMEOUT) and go to sleep;
Q: what if there are tasks that are always 
running when we try to call apm_do_idle ? 
A: we never enter the kapmd inner loop.

the ?solution?:
make the timeout short if we find that the system is busy, 
some tries later if the system is idle enough we will enter 
the kapmd inner loop and do some power mgt.

Alternative solution instead of setting timeout to 1 we could

timeout >>= 2; /divide by 4
and clamp the value to 1 if it becomes 0

So the timeout changes smoothly.

On my system this makes kapmd come back fast.(without evil side effects, I hope ;) )

Let me know if this is useful somehow.

the patch is against vanilla 2.4.9

Regards

--
Delio

--- arch/i386/kernel/apm.c.orig	Tue Aug 14 01:39:28 2001
+++ arch/i386/kernel/apm.c	Tue Sep  4 11:02:24 2001
@@ -1136,8 +1136,10 @@
 		set_current_state(TASK_INTERRUPTIBLE);
 		apm_event_handler();
 #ifdef CONFIG_APM_CPU_IDLE
-		if (!system_idle())
+		if (!system_idle()) {
+			timeout = 1;
 			continue;
+		}
 		if (apm_do_idle()) {
 			unsigned long start = jiffies;
 			while ((!exit_kapmd) && system_idle()) {

                 reply	other threads:[~2001-09-06  9:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20010906114224.A1468@argo.tin.it \
    --to=nordkyn@tin.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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).