public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Nigel Cunningham <nigel@nigel.suspend2.net>
To: Pavel Machek <pavel@ucw.cz>
Cc: Pekka J Enberg <penberg@cs.helsinki.fi>, linux-pm@lists.osdl.org
Subject: Re: [RFC/PATCH 2/2] kernel: don't update load average during snapshot/shutdown
Date: Sat, 28 Apr 2007 07:32:03 +1000	[thread overview]
Message-ID: <1177709523.4737.157.camel@nigel.suspend2.net> (raw)
In-Reply-To: <20070427145212.GO22250@elf.ucw.cz>


[-- Attachment #1.1: Type: text/plain, Size: 2492 bytes --]

Hi.

On Fri, 2007-04-27 at 16:52 +0200, Pavel Machek wrote:
> Hi!
> 
> > From: Nigel Cunningham <nigel@nigel.suspend2.net>
> > 
> > As explained by Nigel, Sendmail and some other programs look at the
> > load average and stop delivering when it gets too high.  The CPU
> > intensiveness of suspending to disk pushes the load average up quite
> > high but post-resume we shouldn't really take that into account.  Not
> > updating the load average therefore makes snapshot/shutdown invisible
> > to sendmail and so on.
> 
> Is it kernel problem? We _had_ high load, and load average goes down
> pretty quickly.

Don't make artificial distinctions between kernelspace and userspace.

The load average doesn't go down that quickly, and the intensiveness of
the work can make the load average _really_ high. Remember that you're
probably not seeing this because you do an atomic copy pretty quickly.
If you're compressing and writing 80% of ram to disk before the atomic
copy, what will your load average be at the end of that?

> > @@ -1253,9 +1254,18 @@ static inline void calc_load(unsigned lo
> >  	if (unlikely(count < 0)) {
> >  		active_tasks = count_active_tasks();
> >  		do {
> > -			CALC_LOAD(avenrun[0], EXP_1, active_tasks);
> > -			CALC_LOAD(avenrun[1], EXP_5, active_tasks);
> > -			CALC_LOAD(avenrun[2], EXP_15, active_tasks);
> > +			/*
> > +			 * If we let the load average be updated while
> > +			 * snapshot/shutdown, 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 (likely(!freezer_is_on())) {
> > +				CALC_LOAD(avenrun[0], EXP_1, active_tasks);
> > +				CALC_LOAD(avenrun[1], EXP_5, active_tasks);
> > +				CALC_LOAD(avenrun[2], EXP_15, active_tasks);
> > +			}
> >  			count += LOAD_FREQ;
> >  		} while (count < 0);
> >  	}
> 
> NAK. This slows down regular operation, at it is 30 lines for what
> should have been one (or five).

Count them. It is one line (an if statement) plus seven lines of
comment.

> Just place avenrun[0] = avenrun[1] = avenrun[2] = 0 at strategic place
> if you feel strongly about this. Additional points for using Rafael's
> "suspend done" notifier so that you don't have to modify suspend core.

=0 might not be right. If you did have a high load average prior to
suspending, not delivering email would be the right thing to do.

Nigel

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  parent reply	other threads:[~2007-04-27 21:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-27 13:29 [RFC/PATCH 2/2] kernel: don't update load average during snapshot/shutdown Pekka J Enberg
2007-04-27 14:52 ` Pavel Machek
2007-04-27 14:55   ` Pekka Enberg
2007-04-27 21:32   ` Nigel Cunningham [this message]
2007-04-27 22:12     ` Pavel Machek
2007-04-27 22:18       ` Nigel Cunningham
2007-04-27 22:25         ` Pavel Machek
2007-04-27 23:05           ` Nigel Cunningham
2007-04-28  8:01             ` Pavel Machek
2007-04-28  8:26             ` Pekka Enberg
2007-04-28 10:49               ` Rafael J. Wysocki
2007-04-28 18:07                 ` Rafael J. Wysocki
2007-04-28 22:52                 ` Nigel Cunningham
2007-04-27 15:00 ` Rafael J. Wysocki
2007-04-27 14:59   ` Pekka Enberg
2007-04-27 15:31     ` Rafael J. Wysocki
2007-04-27 15:02   ` Johannes Berg
2007-04-27 15:05     ` Pavel Machek
2007-04-27 15:12       ` Johannes Berg
2007-04-27 15:14         ` Pavel Machek
2007-04-27 15:53         ` Rafael J. Wysocki
2007-04-27 19:56           ` Johannes Berg
2007-04-27 15:16   ` Gautham R Shenoy
2007-04-27 15:30     ` Rafael J. Wysocki

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=1177709523.4737.157.camel@nigel.suspend2.net \
    --to=nigel@nigel.suspend2.net \
    --cc=linux-pm@lists.osdl.org \
    --cc=pavel@ucw.cz \
    --cc=penberg@cs.helsinki.fi \
    /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