The Difference in Load Average calculations in linux 2.4.19 and 2.6
From: sena
Date: Wed Jan 14 2004 - 01:42:41 EST
Hi,
Please can anyone who has written/define Load Average confirm the following statement.
"If there is only 1 CPU in the box, then the Load Average Calculations are going to be almost same in
2.6 and 2.4"
In 2.6 Linux kernel
static unsigned long count_active_tasks <http://lxr.linux.no/ident?v=2.6.0;i=count_active_tasks>(void)
{
return (nr_running <http://lxr.linux.no/ident?v=2.6.0;i=nr_running>() + nr_uninterruptible <http://lxr.linux.no/ident?v=2.6.0;i=nr_uninterruptible>()) * FIXED_1 <http://lxr.linux.no/ident?v=2.6.0;i=FIXED_1>;
}
In 2.4 linux kernel
static unsigned long count_active_tasks <http://lxr.linux.no/ident?v=2.4.19;i=count_active_tasks>(void)
{
struct task_struct <http://lxr.linux.no/ident?v=2.4.19;i=task_struct> *p <http://lxr.linux.no/ident?v=2.4.19;i=p>;
unsigned long nr <http://lxr.linux.no/ident?v=2.4.19;i=nr> = 0;
read_lock <http://lxr.linux.no/ident?v=2.4.19;i=read_lock>(&tasklist_lock <http://lxr.linux.no/ident?v=2.4.19;i=tasklist_lock>);
for_each_task <http://lxr.linux.no/ident?v=2.4.19;i=for_each_task>(p <http://lxr.linux.no/ident?v=2.4.19;i=p>) {
if ((p <http://lxr.linux.no/ident?v=2.4.19;i=p>->state <http://lxr.linux.no/ident?v=2.4.19;i=state> == TASK_RUNNING <http://lxr.linux.no/ident?v=2.4.19;i=TASK_RUNNING> ||
(p <http://lxr.linux.no/ident?v=2.4.19;i=p>->state <http://lxr.linux.no/ident?v=2.4.19;i=state> & TASK_UNINTERRUPTIBLE <http://lxr.linux.no/ident?v=2.4.19;i=TASK_UNINTERRUPTIBLE>)))
nr <http://lxr.linux.no/ident?v=2.4.19;i=nr> += FIXED_1 <http://lxr.linux.no/ident?v=2.4.19;i=FIXED_1>;
}
read_unlock <http://lxr.linux.no/ident?v=2.4.19;i=read_unlock>(&tasklist_lock <http://lxr.linux.no/ident?v=2.4.19;i=tasklist_lock>);
return nr <http://lxr.linux.no/ident?v=2.4.19;i=nr>;
}
Thanks
Sena Seneviratne
Computer Engineering Lab
Sydney University
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/