mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* The Difference in Load Average calculations in linux 2.4.19 and 2.6
@ 2004-01-14 17:38 sena
  0 siblings, 0 replies; only message in thread
From: sena @ 2004-01-14 17:38 UTC (permalink / raw)
  To: linux-kernel, Rusty Russell, Linus Torvalds, Nuno Silva, Robin Holt

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-01-14  6:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-14 17:38 The Difference in Load Average calculations in linux 2.4.19 and 2.6 sena

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®