[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1269211524-29332-1-git-send-email-chase.douglas@canonical.com>
Date: Sun, 21 Mar 2010 18:45:23 -0400
From: Chase Douglas <chase.douglas@...onical.com>
To: linux-kernel@...r.kernel.org
Cc: Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: [PATCH 0/1] sched: defer idle accounting till after load update period
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.
--
#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;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists