public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: akpm@osdl.org, rusty@rustcorp.com.au
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] use for_each_cpu
Date: Sun, 1 Aug 2004 16:01:44 +1000	[thread overview]
Message-ID: <20040801060144.GI30253@krispykreme> (raw)


Hi,

The per cpu schedule counters need to be summed up over all possible cpus.
When testing hotplug cpu remove I saw the sum of the online cpu count
for nr_uninterruptible go negative which made the load average go nuts.

Anton

diff -puN kernel/sched.c~debug_nr_running kernel/sched.c
--- foobar2/kernel/sched.c~debug_nr_running	2004-08-01 14:42:46.133968016 +1000
+++ foobar2-anton/kernel/sched.c	2004-08-01 15:26:17.272626720 +1000
@@ -1095,7 +1095,7 @@ unsigned long nr_uninterruptible(void)
 {
 	unsigned long i, sum = 0;
 
-	for_each_online_cpu(i)
+	for_each_cpu(i)
 		sum += cpu_rq(i)->nr_uninterruptible;
 
 	return sum;
@@ -1105,7 +1105,7 @@ unsigned long long nr_context_switches(v
 {
 	unsigned long long i, sum = 0;
 
-	for_each_online_cpu(i)
+	for_each_cpu(i)
 		sum += cpu_rq(i)->nr_switches;
 
 	return sum;
@@ -1115,7 +1115,7 @@ unsigned long nr_iowait(void)
 {
 	unsigned long i, sum = 0;
 
-	for_each_online_cpu(i)
+	for_each_cpu(i)
 		sum += atomic_read(&cpu_rq(i)->nr_iowait);
 
 	return sum;

             reply	other threads:[~2004-08-01  6:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-01  6:01 Anton Blanchard [this message]
2004-08-01  6:08 ` [PATCH] use for_each_cpu Andrew Morton
2004-08-01  7:27   ` Anton Blanchard
2004-08-01  7:47     ` Andrew Morton
2004-08-01 21:00       ` Anton Blanchard
2004-08-02  5:59       ` Rusty Russell

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=20040801060144.GI30253@krispykreme \
    --to=anton@samba.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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