From: Glauber Costa <glommer@parallels.com>
To: linux-kernel@vger.kernel.org
Cc: xemul@parallels.com, paul@paulmenage.org, lizf@cn.fujitsu.com,
daniel.lezcano@free.fr, mingo@elte.hu, a.p.zijlstra@chello.nl,
jbottomley@parallels.com, Glauber Costa <glommer@parallels.com>
Subject: [PATCH 4/9] Include irq and softirq fields in cpuacct
Date: Wed, 14 Sep 2011 17:04:50 -0300 [thread overview]
Message-ID: <1316030695-19826-5-git-send-email-glommer@parallels.com> (raw)
In-Reply-To: <1316030695-19826-1-git-send-email-glommer@parallels.com>
Signed-off-by: Glauber Costa <glommer@parallels.com>
---
kernel/sched.c | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 93aa666..a36d995 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1448,6 +1448,8 @@ enum cpuacct_stat_index {
CPUACCT_STAT_USER, /* ... user mode */
CPUACCT_STAT_NICE, /* ... user nice */
CPUACCT_STAT_SYSTEM, /* ... kernel mode */
+ CPUACCT_STAT_IRQ, /* ... irq ticks */
+ CPUACCT_STAT_SOFTIRQ, /* ... softirq ticks */
CPUACCT_STAT_NSTATS,
};
@@ -3819,7 +3821,8 @@ static void account_guest_time(struct task_struct *p, cputime_t cputime,
*/
static inline
void __account_system_time(struct task_struct *p, cputime_t cputime,
- cputime_t cputime_scaled, cputime64_t *target_cputime64)
+ cputime_t cputime_scaled,
+ cputime64_t *target_cputime64, int stat)
{
cputime64_t tmp = cputime_to_cputime64(cputime);
@@ -3830,10 +3833,10 @@ void __account_system_time(struct task_struct *p, cputime_t cputime,
/* Add system time to cpustat. */
*target_cputime64 = cputime64_add(*target_cputime64, tmp);
- cpuacct_update_stats(p, CPUACCT_STAT_SYSTEM, cputime);
/* Account for system time used */
acct_update_integrals(p);
+ cpuacct_update_stats(p, stat, cputime);
}
/*
@@ -3848,20 +3851,23 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
{
struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
cputime64_t *target_cputime64;
+ int stat = CPUACCT_STAT_SYSTEM;
if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
account_guest_time(p, cputime, cputime_scaled);
return;
}
- if (hardirq_count() - hardirq_offset)
+ if (hardirq_count() - hardirq_offset) {
target_cputime64 = &cpustat->irq;
- else if (in_serving_softirq())
+ stat = CPUACCT_STAT_IRQ;
+ } else if (in_serving_softirq()) {
target_cputime64 = &cpustat->softirq;
- else
+ stat = CPUACCT_STAT_SOFTIRQ;
+ } else
target_cputime64 = &cpustat->system;
- __account_system_time(p, cputime, cputime_scaled, target_cputime64);
+ __account_system_time(p, cputime, cputime_scaled, target_cputime64, stat);
}
/*
@@ -3941,22 +3947,26 @@ static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
cputime_t one_jiffy_scaled = cputime_to_scaled(cputime_one_jiffy);
cputime64_t tmp = cputime_to_cputime64(cputime_one_jiffy);
struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
+ int stat = CPUACCT_STAT_SYSTEM;
if (steal_account_process_tick())
return;
if (irqtime_account_hi_update()) {
cpustat->irq = cputime64_add(cpustat->irq, tmp);
+ cpuacct_update_stats(p, CPUACCT_STAT_IRQ, tmp);
} else if (irqtime_account_si_update()) {
cpustat->softirq = cputime64_add(cpustat->softirq, tmp);
+ cpuacct_update_stats(p, CPUACCT_STAT_SOFTIRQ, tmp);
} else if (this_cpu_ksoftirqd() == p) {
+ stat = CPUACCT_STAT_SOFTIRQ;
/*
* ksoftirqd time do not get accounted in cpu_softirq_time.
* So, we have to handle it separately here.
* Also, p->stime needs to be updated for ksoftirqd.
*/
__account_system_time(p, cputime_one_jiffy, one_jiffy_scaled,
- &cpustat->softirq);
+ &cpustat->softirq, stat);
} else if (user_tick) {
account_user_time(p, cputime_one_jiffy, one_jiffy_scaled);
} else if (p == rq->idle) {
@@ -3965,7 +3975,7 @@ static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
account_guest_time(p, cputime_one_jiffy, one_jiffy_scaled);
} else {
__account_system_time(p, cputime_one_jiffy, one_jiffy_scaled,
- &cpustat->system);
+ &cpustat->system, stat);
}
}
--
1.7.6
next prev parent reply other threads:[~2011-09-14 20:06 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-14 20:04 [PATCH 0/9] Per-cgroup /proc/stat Glauber Costa
2011-09-14 20:04 ` [PATCH 1/9] Remove parent field in cpuacct cgroup Glauber Costa
2011-09-19 16:03 ` Peter Zijlstra
2011-09-19 16:09 ` Glauber Costa
2011-09-19 16:19 ` Peter Zijlstra
2011-09-19 16:30 ` Glauber Costa
2011-09-19 16:39 ` Peter Zijlstra
2011-09-19 16:41 ` Glauber Costa
2011-09-19 18:40 ` Peter Zijlstra
2011-09-20 17:29 ` Srivatsa Vaddagiri
2011-09-22 15:11 ` Balbir Singh
2011-09-22 15:17 ` Peter Zijlstra
2011-09-23 8:09 ` Balbir Singh
2011-09-23 14:35 ` Peter Zijlstra
2011-09-23 15:45 ` Glauber Costa
2011-09-19 18:35 ` Peter Zijlstra
2011-09-19 18:38 ` Glauber Costa
2011-09-19 18:44 ` Peter Zijlstra
2011-09-19 19:14 ` Glauber Costa
2011-09-19 19:18 ` Peter Zijlstra
2011-09-19 19:19 ` Glauber Costa
2011-09-14 20:04 ` [PATCH 2/9] Make cpuacct fields per cpu variables Glauber Costa
2011-09-19 16:10 ` Peter Zijlstra
2011-09-14 20:04 ` [PATCH 3/9] Include nice values in cpuacct Glauber Costa
2011-09-19 16:19 ` Peter Zijlstra
2011-09-19 16:26 ` Glauber Costa
2011-09-19 18:36 ` Peter Zijlstra
2011-09-19 18:37 ` Glauber Costa
2011-09-14 20:04 ` Glauber Costa [this message]
2011-09-19 18:38 ` [PATCH 4/9] Include irq and softirq fields " Peter Zijlstra
2011-09-19 18:40 ` Glauber Costa
2011-09-14 20:04 ` [PATCH 5/9] Include guest " Glauber Costa
2011-09-14 20:04 ` [PATCH 6/9] Include idle and iowait " Glauber Costa
2011-09-20 9:21 ` Peter Zijlstra
2011-09-20 12:36 ` Glauber Costa
2011-09-20 12:58 ` Peter Zijlstra
2011-09-20 12:58 ` Glauber Costa
2011-09-20 13:05 ` Peter Zijlstra
2011-09-20 13:29 ` Glauber Costa
2011-09-14 20:04 ` [PATCH 7/9] Create cpuacct.proc.stat file Glauber Costa
2011-09-20 9:22 ` Peter Zijlstra
2011-09-20 12:22 ` Glauber Costa
2011-09-14 20:04 ` [PATCH 8/9] per-cgroup boot time Glauber Costa
2011-09-20 9:25 ` Peter Zijlstra
2011-09-20 12:37 ` Glauber Costa
2011-09-20 13:04 ` Peter Zijlstra
2011-09-20 13:06 ` Glauber Costa
2011-09-20 13:31 ` Peter Zijlstra
2011-09-14 20:04 ` [PATCH 9/9] Report steal time for cgroup Glauber Costa
2011-09-20 9:29 ` Peter Zijlstra
2011-09-14 20:13 ` [PATCH 0/9] Per-cgroup /proc/stat Peter Zijlstra
2011-09-14 20:20 ` Glauber Costa
2011-09-15 8:53 ` Peter Zijlstra
2011-09-14 20:23 ` Andi Kleen
2011-09-15 8:56 ` Peter Zijlstra
2011-09-19 23:07 ` Paul Turner
2011-09-20 8:33 ` Peter Zijlstra
2011-09-20 21:37 ` Glauber Costa
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=1316030695-19826-5-git-send-email-glommer@parallels.com \
--to=glommer@parallels.com \
--cc=a.p.zijlstra@chello.nl \
--cc=daniel.lezcano@free.fr \
--cc=jbottomley@parallels.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
--cc=paul@paulmenage.org \
--cc=xemul@parallels.com \
/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®