mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chase Douglas <chase.douglas@canonical.com>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>
Subject: [REGRESSION 2.6.30][PATCH 0/1] sched: defer idle accounting till after load update period
Date: Mon, 29 Mar 2010 09:41:11 -0400	[thread overview]
Message-ID: <1269870072-22449-1-git-send-email-chase.douglas@canonical.com> (raw)

The following patch fixes a load avg calculation bug. Details are included with
the patch. Essentially, a task that often runs for less than 10 ticks at a time
is likely to be left out of the load avg calculation. A test case is provided
below. If you run the test case on a near zero-load system you will find top
report 90% cpu usage while the load avg stays at or near 0.00. With the patch,
the load avg is calculated correctly to be at least 0.90.

This is a regression since 2.6.30. The offending commit is:
dce48a84adf1806676319f6f480e30a6daa012f9.

--

#include <asm/param.h>
#include <sys/time.h>
#include <time.h>

int main() {
	struct timespec ts;
	ts.tv_sec = 0;
	ts.tv_nsec = 1000000000 / HZ;

	/*
	 * Run gettimeofday in a tight loop 9 ticks, then sleep for 1 tick
	 */
	while (1) {
		struct timeval tv;

		do {
			gettimeofday(&tv, NULL);
		} while ((tv.tv_usec * HZ / 1000000) % 10 != 0);

		nanosleep(&ts, NULL);
	}
	return 0;
}

             reply	other threads:[~2010-03-29 13:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-29 13:41 Chase Douglas [this message]
2010-03-29 13:41 ` [REGRESSION 2.6.30][PATCH 1/1] " Chase Douglas
2010-03-29 14:41   ` Peter Zijlstra
2010-03-29 17:20     ` Chase Douglas
2010-04-01 19:27   ` Andrew Morton
2010-04-01 19:37     ` Thomas Gleixner
2010-04-01 20:00       ` Chase Douglas
2010-04-01 20:18         ` Thomas Gleixner
2010-04-01 20:32           ` Chase Douglas
2010-04-01 20:37             ` Thomas Gleixner
2010-04-02  7:59           ` Peter Zijlstra
2010-04-05 14:44             ` Chase Douglas
2010-04-01 19:56     ` Chase Douglas
2010-04-01 20:01       ` Thomas Gleixner
2010-04-13 20:39         ` Andrew Morton
2010-04-13 21:02           ` Thomas Gleixner
2010-04-13 21:06             ` Chase Douglas

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=1269870072-22449-1-git-send-email-chase.douglas@canonical.com \
    --to=chase.douglas@canonical.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rjw@sisk.pl \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®