From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] cputime: fix account_steal_time.
Date: Fri, 14 Jan 2005 15:41:05 +0100 [thread overview]
Message-ID: <20050114144105.GA5416@mschwid3.boeblingen.de.ibm.com> (raw)
Hi Andrew,
after the cputime patches have hit BitKeeper, Uli had a look at them and
being Uli he found a bug. Actually three bugs but they are all in the
same function. The bugs are only relevant for an architecture that uses
account_steal_time which is currently s390 only.
blue skies,
Martin.
---
[PATCH] cputime: fix account_steal_time.
From: Ulrich Weigand <uweigand@de.ibm.com>
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
account_steal_time called for idle doesn't work correctly:
1) steal time while idle needs to be added to the system time of idle
to get correct uptime numbers
3) if there is an i/o request outstanding the steal time should be
added to iowait, even if the hypervisor scheduled another virtual
cpu since we are still waiting for i/o.
2) steal time while idle without an i/o request outstanding has to
be added to cpustat->idle and not to cpustat->system.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
diffstat:
kernel/sched.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff -urN linux-2.6/kernel/sched.c linux-2.6-patched/kernel/sched.c
--- linux-2.6/kernel/sched.c 2005-01-14 15:02:43.000000000 +0100
+++ linux-2.6-patched/kernel/sched.c 2005-01-14 15:02:52.000000000 +0100
@@ -2383,13 +2383,17 @@
void account_steal_time(struct task_struct *p, cputime_t steal)
{
struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
- cputime64_t steal64 = cputime_to_cputime64(steal);
+ cputime64_t tmp = cputime_to_cputime64(steal);
runqueue_t *rq = this_rq();
- if (p == rq->idle)
- cpustat->system = cputime64_add(cpustat->system, steal64);
- else
- cpustat->steal = cputime64_add(cpustat->steal, steal64);
+ if (p == rq->idle) {
+ p->stime = cputime_add(p->stime, steal);
+ if (atomic_read(&rq->nr_iowait) > 0)
+ cpustat->iowait = cputime64_add(cpustat->iowait, tmp);
+ else
+ cpustat->idle = cputime64_add(cpustat->idle, tmp);
+ } else
+ cpustat->steal = cputime64_add(cpustat->steal, tmp);
}
/*
reply other threads:[~2005-01-14 14:41 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=20050114144105.GA5416@mschwid3.boeblingen.de.ibm.com \
--to=schwidefsky@de.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.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®