The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Nigel Cunningham <nigel@suspend2.net>
To: linux-kernel@vger.kernel.org
Subject: [Suspend2][ 1/2] [Suspend2] Disable load updating during suspending.
Date: Tue, 27 Jun 2006 02:38:54 +1000	[thread overview]
Message-ID: <20060626163852.10345.788.stgit@nigel.suspend2.net> (raw)
In-Reply-To: <20060626163850.10345.13807.stgit@nigel.suspend2.net>

Suspend2 uses the cpu very intensively, with the result that the load
average can be quite high when a cycle has just completed. This in turn can
cause problems with mail delivery and other activities that suspend
activities when the load average gets too high. To avoid this, we suspend
updates of the load average while the freezer is on.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

 kernel/timer.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/kernel/timer.c b/kernel/timer.c
index 9e49dee..44a17fc 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -34,6 +34,7 @@
 #include <linux/cpu.h>
 #include <linux/syscalls.h>
 #include <linux/delay.h>
+#include <linux/freezer.h>
 
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
@@ -869,6 +870,16 @@ static inline void calc_load(unsigned lo
 	count -= ticks;
 	if (count < 0) {
 		count += LOAD_FREQ;
+
+		/* Suspend2 does a lot of work (pagecache I/O) before
+		 * and after the atomic copy. If we let the load average
+		 * be updated while suspending, it will be very high post
+		 * resume. Processes such as some MTAs that stop work
+		 * while the average is high will be unnecessarily disrupted.
+		 */
+		if (freezer_is_on())
+			return;
+
 		active_tasks = count_active_tasks();
 		CALC_LOAD(avenrun[0], EXP_1, active_tasks);
 		CALC_LOAD(avenrun[1], EXP_5, active_tasks);

--
Nigel Cunningham		nigel at suspend2 dot net

  reply	other threads:[~2006-06-26 16:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 16:38 [Suspend2][ 0/2] Freezer Upgrade Nigel Cunningham
2006-06-26 16:38 ` Nigel Cunningham [this message]
2006-06-27 12:07   ` [Suspend2][ 1/2] [Suspend2] Disable load updating during suspending Pavel Machek
2006-06-27 12:16     ` Nigel Cunningham
2006-06-27 12:35       ` Andreas Mohr
2006-06-26 16:38 ` [Suspend2][ 2/2] [Suspend2] Freezer upgrade Nigel Cunningham
2006-06-26 20:01   ` Rafael J. Wysocki
2006-06-26 22:48     ` Nigel Cunningham
2006-06-27 11:09       ` Pavel Machek
2006-06-27 12:13         ` Nigel Cunningham

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=20060626163852.10345.788.stgit@nigel.suspend2.net \
    --to=nigel@suspend2.net \
    --cc=linux-kernel@vger.kernel.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