mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sena <auntvini@sedal.usyd.edu.au>
To: linux-kernel <linux-kernel@vger.kernel.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Linus Torvalds <torvalds@osdl.org>,
	Nuno Silva <nuno.silva@vgertech.com>, Robin Holt <holt@sgi.com>
Subject: The Difference in Load Average calculations in linux 2.4.19 and 2.6
Date: Thu, 15 Jan 2004 04:38:38 +1100	[thread overview]
Message-ID: <40057E9E.1000705@sedal.usyd.edu.au> (raw)

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



                 reply	other threads:[~2004-01-14  6:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=40057E9E.1000705@sedal.usyd.edu.au \
    --to=auntvini@sedal.usyd.edu.au \
    --cc=holt@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.silva@vgertech.com \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@osdl.org \
    /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®