sched, cpuacct: fix niced guest time accounting
Subsystems (3)
PATCH 1/1 sched, cpuacct: fix niced guest time accounting
Hi Avi,
This is the patch we discussed earlier. Please review it.
BTW, should this be sent to lkml as well?
Regards,
ozaki-r
Quoted 1 line
From
8aea0f1a9acc891d1208bc462a05797765451ab4Mon Sep 17 00:00:00 2001
From: Ryota Ozaki <[email protected]>
Date: Tue, 20 Oct 2009 22:41:12 +0900
Subject: [PATCH] sched, cpuacct: fix niced guest time accounting
CPU time of a guest is always accounted in 'user' time without concern for the nice value of its counterpart process although the guest is scheduled under the nice value.
This patch fixes the defect and accounts cpu time of a niced guest in 'nice' time as same as a niced process.
And also the patch adds 'guest_nice' to cpuacct. The value provides niced guest cpu time which is like 'nice' to 'user'.
--- Documentation/filesystems/proc.txt | 3 ++- fs/proc/stat.c | 17 +++++++++++------ include/linux/kernel_stat.h | 1 + kernel/sched.c | 9 +++++++-- 4 files changed, 21 insertions(+), 9 deletions(-)
(quoted diff) +0 -0
b/Documentation/filesystems/proc.txt
index 2c48f94..4af0018 100644
Documentation/filesystems/proc.txt +0 -0
@@ -1072,7 +1072,8 @@ second). The meanings of the columns are as
follows, from left to right:
- irq: servicing interrupts
- softirq: servicing softirqs
- steal: involuntary wait
-- guest: running a guest
+- guest: running a normal guest +- guest_nice: running a niced guest
The "intr" line gives counts of interrupts serviced since boot time, for each
of the possible system interrupts. The first column is the total of all
fs/proc/stat.c +11 -6
@@ -27,7 +27,7 @@ static int show_stat(struct seq_file *p, void *v)int i, j;unsigned long jif;cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; -cputime64_t guest; +cputime64_t guest, guest_nice;u64 sum =0 ;u64 sum_softirq =0 ;unsigned int per_softirq_sums[NR_SOFTIRQS ] = {0 };
@@ -36,7 +36,7 @@ static int show_stat(struct seq_file *p, void *v) user = nice = system = idle = iowait = irq = softirq = steal = cputime64_zero; - guest = cputime64_zero; + guest = guest_nice = cputime64_zero;getboottime (&boottime); jif = boottime.tv_sec;
@@ -51,6 +51,8 @@ static int show_stat(struct seq_file *p, void *v) softirq =cputime64_add (softirq,kstat_cpu (i).cpustat.softirq); steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest); + guest_nice =cputime64_add (guest_nice, +kstat_cpu (i).cpustat.guest_nice);for_each_irq_nr (j) { sum +=kstat_irqs_cpu (j, i); }
@@ -65,7 +67,7 @@ static int show_stat(struct seq_file *p, void *v) } sum +=arch_irq_stat (); - seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu¥n", + seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu¥n", (unsigned long long)cputime64_to_clock_t(user), (unsigned long long)cputime64_to_clock_t(nice), (unsigned long long)cputime64_to_clock_t(system),
@@ -74,7 +76,8 @@ static int show_stat(struct seq_file *p, void *v) (unsigned long long )cputime64_to_clock_t (irq), (unsigned long long )cputime64_to_clock_t (softirq), (unsigned long long )cputime64_to_clock_t (steal), - (unsigned long long)cputime64_to_clock_t(guest)); + (unsigned long long )cputime64_to_clock_t (guest), + (unsigned long long)cputime64_to_clock_t(guest_nice));for_each_online_cpu (i) {/* Copy values here to work around gcc-2.95.3, gcc-2.96 */
@@ -88,8 +91,9 @@ static int show_stat(struct seq_file *p, void *v) softirq =kstat_cpu (i).cpustat.softirq; steal =kstat_cpu (i).cpustat.steal; guest =kstat_cpu (i).cpustat.guest; + guest_nice =kstat_cpu (i).cpustat.guest_nice; seq_printf(p, - "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu¥n", + "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu¥n", i, (unsigned long long)cputime64_to_clock_t(user), (unsigned long long)cputime64_to_clock_t(nice),
@@ -99,7 +103,8 @@ static int show_stat(struct seq_file *p, void *v) (unsigned long long )cputime64_to_clock_t (irq), (unsigned long long )cputime64_to_clock_t (softirq), (unsigned long long )cputime64_to_clock_t (steal), - (unsigned long long)cputime64_to_clock_t(guest)); + (unsigned long long )cputime64_to_clock_t (guest), + (unsigned long long)cputime64_to_clock_t(guest_nice)); }seq_printf (p,"intr %llu" , (unsigned long long )sum);
include/linux/kernel_stat.h +1 -0
@@ -25,6 +25,7 @@ struct cpu_usage_stat {cputime64_t iowait;cputime64_t steal;cputime64_t guest; +cputime64_t guest_nice; };struct kernel_stat {
kernel/sched.c +0 -0
@@ -5017,8 +5017,13 @@ static void account_guest_time(struct
task_struct *p, cputime_t cputime,
p->gtime = cputime_add(p->gtime, cputime);
/* Add guest time to cpustat. */
- cpustat->user = cputime64_add(cpustat->user, tmp);
- cpustat->guest = cputime64_add(cpustat->guest, tmp);
+ if (TASK_NICE(p) > 0) {
+ cpustat->nice = cputime64_add(cpustat->nice, tmp);
+ cpustat->guest_nice = cputime64_add(cpustat->guest_nice, tmp);
+ } else {
+ cpustat->user = cputime64_add(cpustat->user, tmp);
+ cpustat->guest = cputime64_add(cpustat->guest, tmp);
+ }
}
/*
Signature · 1 line
1.6.2.5
From 8aea0f1a9acc891d1208bc462a05797765451ab4 Mon Sep 17 00:00:00 2001
From: Ryota Ozaki <[email protected]>
Date: Tue, 20 Oct 2009 22:41:12 +0900
Subject: [PATCH] sched, cpuacct: fix niced guest time accounting
CPU time of a guest is always accounted in 'user' time without concern for the nice value of its counterpart process although the guest is scheduled under the nice value.
This patch fixes the defect and accounts cpu time of a niced guest in 'nice' time as same as a niced process.
And also the patch adds 'guest_nice' to cpuacct. The value provides niced guest cpu time which is like 'nice' to 'user'.
--- Documentation/filesystems/proc.txt | 3 ++- fs/proc/stat.c | 17 +++++++++++------ include/linux/kernel_stat.h | 1 + kernel/sched.c | 9 +++++++-- 4 files changed, 21 insertions(+), 9 deletions(-)
Documentation/filesystems/proc.txt +2 -1
@@ -1072,7 +1072,8 @@ second). The meanings of the columns are as follows, from left to right: - irq: servicing interrupts - softirq: servicing softirqs - steal: involuntary wait -- guest: running a guest +- guest: running a normal guest +- guest_nice: running a niced guest The "intr" line gives counts of interrupts serviced since boot time, for each of the possible system interrupts. The first column is the total of all
fs/proc/stat.c +11 -6
@@ -27,7 +27,7 @@ static int show_stat(struct seq_file *p, void *v)int i, j;unsigned long jif;cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; -cputime64_t guest; +cputime64_t guest, guest_nice;u64 sum =0 ;u64 sum_softirq =0 ;unsigned int per_softirq_sums[NR_SOFTIRQS ] = {0 };
@@ -36,7 +36,7 @@ static int show_stat(struct seq_file *p, void *v) user = nice = system = idle = iowait = irq = softirq = steal = cputime64_zero; - guest = cputime64_zero; + guest = guest_nice = cputime64_zero;getboottime (&boottime); jif = boottime.tv_sec;
@@ -51,6 +51,8 @@ static int show_stat(struct seq_file *p, void *v) softirq =cputime64_add (softirq,kstat_cpu (i).cpustat.softirq); steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest); + guest_nice =cputime64_add (guest_nice, +kstat_cpu (i).cpustat.guest_nice);for_each_irq_nr (j) { sum +=kstat_irqs_cpu (j, i); }
@@ -65,7 +67,7 @@ static int show_stat(struct seq_file *p, void *v) } sum +=arch_irq_stat (); - seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", + seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", (unsigned long long)cputime64_to_clock_t(user), (unsigned long long)cputime64_to_clock_t(nice), (unsigned long long)cputime64_to_clock_t(system),
@@ -74,7 +76,8 @@ static int show_stat(struct seq_file *p, void *v) (unsigned long long )cputime64_to_clock_t (irq), (unsigned long long )cputime64_to_clock_t (softirq), (unsigned long long )cputime64_to_clock_t (steal), - (unsigned long long)cputime64_to_clock_t(guest)); + (unsigned long long )cputime64_to_clock_t (guest), + (unsigned long long)cputime64_to_clock_t(guest_nice));for_each_online_cpu (i) {/* Copy values here to work around gcc-2.95.3, gcc-2.96 */
@@ -88,8 +91,9 @@ static int show_stat(struct seq_file *p, void *v) softirq =kstat_cpu (i).cpustat.softirq; steal =kstat_cpu (i).cpustat.steal; guest =kstat_cpu (i).cpustat.guest; + guest_nice =kstat_cpu (i).cpustat.guest_nice; seq_printf(p, - "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", + "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", i, (unsigned long long)cputime64_to_clock_t(user), (unsigned long long)cputime64_to_clock_t(nice),
@@ -99,7 +103,8 @@ static int show_stat(struct seq_file *p, void *v) (unsigned long long )cputime64_to_clock_t (irq), (unsigned long long )cputime64_to_clock_t (softirq), (unsigned long long )cputime64_to_clock_t (steal), - (unsigned long long)cputime64_to_clock_t(guest)); + (unsigned long long )cputime64_to_clock_t (guest), + (unsigned long long)cputime64_to_clock_t(guest_nice)); }seq_printf (p,"intr %llu" , (unsigned long long )sum);
include/linux/kernel_stat.h +1 -0
@@ -25,6 +25,7 @@ struct cpu_usage_stat {cputime64_t iowait;cputime64_t steal;cputime64_t guest; +cputime64_t guest_nice; };struct kernel_stat {
kernel/sched.c +7 -2
@@ -5017,8 +5017,13 @@ static void account_guest_time(struct task_struct *p, cputime_t cputime, p->gtime =cputime_add (p->gtime, cputime);/* Add guest time to cpustat. */ - cpustat->user =cputime64_add (cpustat->user, tmp); - cpustat->guest =cputime64_add (cpustat->guest, tmp); +if (TASK_NICE (p) >0 ) { + cpustat->nice =cputime64_add (cpustat->nice, tmp); + cpustat->guest_nice =cputime64_add (cpustat->guest_nice, tmp); + }else { + cpustat->user =cputime64_add (cpustat->user, tmp); + cpustat->guest =cputime64_add (cpustat->guest, tmp); + } }/*
Signature · 1 line
1.6.2.5
Quoted 5 lines · Ryota Ozaki
Hi Avi,
This is the patch we discussed earlier. Please review it.
It looks good to me.
Quoted 3 lines
BTW, should this be sent to lkml as well?
In fact, it should go through tip.git, not kvm.git, so please send to lkml and copy Ingo.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 10 lines · Avi Kivity
Quoted 6 lines · Ryota Ozaki
Hi Avi,
This is the patch we discussed earlier. Please review it.
It looks good to me.
Quoted 7 lines
Quoted 3 lines
BTW, should this be sent to lkml as well?
In fact, it should go through tip.git, not kvm.git, so please send to lkml and copy Ingo.
Thanks for your review. I'll rebase and forward it soon.
ozaki-r
Quoted 7 lines
Acked-by Avi Kivity <[email protected]>--
error compilingcommittee.c: too many arguments to function
PATCH 1/1 sched, cpuacct: fix niced guest time accounting
Hi list,
(CC: Ingo and Avi)
CPU time of a guest is always accounted in 'user' time without concern for the nice value of its counterpart process although the guest is scheduled under the nice value.
This patch fixes the defect and accounts cpu time of a niced guest in 'nice' time as same as a niced process.
And also the patch adds 'guest_nice' to cpuacct. The value provides niced guest cpu time which is like 'nice' to 'user'.
This patch has already reviewed and acked by Avi on KVM ML.
The original discussions can be found here.
http://www.mail-archive.com/[email protected]/msg23982.html
http://www.mail-archive.com/[email protected]/msg23860.html
Thanks,
ozaki-r
Quoted 1 line
From
2be4eb881b35a879b15f4ac58f117455d10535faMon Sep 17 00:00:00 2001
From: Ryota Ozaki <[email protected]>
Date: Tue, 20 Oct 2009 22:41:12 +0900
Subject: [PATCH] sched, cpuacct: fix niced guest time accounting
CPU time of a guest is always accounted in 'user' time without concern for the nice value of its counterpart process although the guest is scheduled under the nice value.
This patch fixes the defect and accounts cpu time of a niced guest in 'nice' time as same as a niced process.
And also the patch adds 'guest_nice' to cpuacct. The value provides niced guest cpu time which is like 'nice' to 'user'.
--- Documentation/filesystems/proc.txt | 3 ++- fs/proc/stat.c | 17 +++++++++++------ include/linux/kernel_stat.h | 1 + kernel/sched.c | 9 +++++++-- 4 files changed, 21 insertions(+), 9 deletions(-)
(quoted diff) +0 -0
b/Documentation/filesystems/proc.txt
index 2c48f94..4af0018 100644
Documentation/filesystems/proc.txt +0 -0
@@ -1072,7 +1072,8 @@ second). The meanings of the columns are as
follows, from left to right:
- irq: servicing interrupts
- softirq: servicing softirqs
- steal: involuntary wait
-- guest: running a guest
+- guest: running a normal guest +- guest_nice: running a niced guest
The "intr" line gives counts of interrupts serviced since boot time, for each
of the possible system interrupts. The first column is the total of all
fs/proc/stat.c +11 -6
@@ -27,7 +27,7 @@ static int show_stat(struct seq_file *p, void *v)int i, j;unsigned long jif;cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; -cputime64_t guest; +cputime64_t guest, guest_nice;u64 sum =0 ;u64 sum_softirq =0 ;unsigned int per_softirq_sums[NR_SOFTIRQS ] = {0 };
@@ -36,7 +36,7 @@ static int show_stat(struct seq_file *p, void *v) user = nice = system = idle = iowait = irq = softirq = steal = cputime64_zero; - guest = cputime64_zero; + guest = guest_nice = cputime64_zero;getboottime (&boottime); jif = boottime.tv_sec;
@@ -51,6 +51,8 @@ static int show_stat(struct seq_file *p, void *v) softirq =cputime64_add (softirq,kstat_cpu (i).cpustat.softirq); steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest); + guest_nice =cputime64_add (guest_nice, +kstat_cpu (i).cpustat.guest_nice);for_each_irq_nr (j) { sum +=kstat_irqs_cpu (j, i); }
@@ -65,7 +67,7 @@ static int show_stat(struct seq_file *p, void *v) } sum +=arch_irq_stat (); - seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu¥n", + seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu¥n", (unsigned long long)cputime64_to_clock_t(user), (unsigned long long)cputime64_to_clock_t(nice), (unsigned long long)cputime64_to_clock_t(system),
@@ -74,7 +76,8 @@ static int show_stat(struct seq_file *p, void *v) (unsigned long long )cputime64_to_clock_t (irq), (unsigned long long )cputime64_to_clock_t (softirq), (unsigned long long )cputime64_to_clock_t (steal), - (unsigned long long)cputime64_to_clock_t(guest)); + (unsigned long long )cputime64_to_clock_t (guest), + (unsigned long long)cputime64_to_clock_t(guest_nice));for_each_online_cpu (i) {/* Copy values here to work around gcc-2.95.3, gcc-2.96 */
@@ -88,8 +91,9 @@ static int show_stat(struct seq_file *p, void *v) softirq =kstat_cpu (i).cpustat.softirq; steal =kstat_cpu (i).cpustat.steal; guest =kstat_cpu (i).cpustat.guest; + guest_nice =kstat_cpu (i).cpustat.guest_nice; seq_printf(p, - "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu¥n", + "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu¥n", i, (unsigned long long)cputime64_to_clock_t(user), (unsigned long long)cputime64_to_clock_t(nice),
@@ -99,7 +103,8 @@ static int show_stat(struct seq_file *p, void *v) (unsigned long long )cputime64_to_clock_t (irq), (unsigned long long )cputime64_to_clock_t (softirq), (unsigned long long )cputime64_to_clock_t (steal), - (unsigned long long)cputime64_to_clock_t(guest)); + (unsigned long long )cputime64_to_clock_t (guest), + (unsigned long long)cputime64_to_clock_t(guest_nice)); }seq_printf (p,"intr %llu" , (unsigned long long )sum);
include/linux/kernel_stat.h +1 -0
@@ -25,6 +25,7 @@ struct cpu_usage_stat {cputime64_t iowait;cputime64_t steal;cputime64_t guest; +cputime64_t guest_nice; };struct kernel_stat {
kernel/sched.c +0 -0
@@ -5017,8 +5017,13 @@ static void account_guest_time(struct
task_struct *p, cputime_t cputime,
p->gtime = cputime_add(p->gtime, cputime);
/* Add guest time to cpustat. */
- cpustat->user = cputime64_add(cpustat->user, tmp);
- cpustat->guest = cputime64_add(cpustat->guest, tmp);
+ if (TASK_NICE(p) > 0) {
+ cpustat->nice = cputime64_add(cpustat->nice, tmp);
+ cpustat->guest_nice = cputime64_add(cpustat->guest_nice, tmp);
+ } else {
+ cpustat->user = cputime64_add(cpustat->user, tmp);
+ cpustat->guest = cputime64_add(cpustat->guest, tmp);
+ }
}
/*
Signature · 1 line
1.6.2.5
From 2be4eb881b35a879b15f4ac58f117455d10535fa Mon Sep 17 00:00:00 2001
From: Ryota Ozaki <[email protected]>
Date: Tue, 20 Oct 2009 22:41:12 +0900
Subject: [PATCH] sched, cpuacct: fix niced guest time accounting
CPU time of a guest is always accounted in 'user' time without concern for the nice value of its counterpart process although the guest is scheduled under the nice value.
This patch fixes the defect and accounts cpu time of a niced guest in 'nice' time as same as a niced process.
And also the patch adds 'guest_nice' to cpuacct. The value provides niced guest cpu time which is like 'nice' to 'user'.
--- Documentation/filesystems/proc.txt | 3 ++- fs/proc/stat.c | 17 +++++++++++------ include/linux/kernel_stat.h | 1 + kernel/sched.c | 9 +++++++-- 4 files changed, 21 insertions(+), 9 deletions(-)
Documentation/filesystems/proc.txt +2 -1
@@ -1072,7 +1072,8 @@ second). The meanings of the columns are as follows, from left to right: - irq: servicing interrupts - softirq: servicing softirqs - steal: involuntary wait -- guest: running a guest +- guest: running a normal guest +- guest_nice: running a niced guest The "intr" line gives counts of interrupts serviced since boot time, for each of the possible system interrupts. The first column is the total of all
fs/proc/stat.c +11 -6
@@ -27,7 +27,7 @@ static int show_stat(struct seq_file *p, void *v)int i, j;unsigned long jif;cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; -cputime64_t guest; +cputime64_t guest, guest_nice;u64 sum =0 ;u64 sum_softirq =0 ;unsigned int per_softirq_sums[NR_SOFTIRQS ] = {0 };
@@ -36,7 +36,7 @@ static int show_stat(struct seq_file *p, void *v) user = nice = system = idle = iowait = irq = softirq = steal = cputime64_zero; - guest = cputime64_zero; + guest = guest_nice = cputime64_zero;getboottime (&boottime); jif = boottime.tv_sec;
@@ -51,6 +51,8 @@ static int show_stat(struct seq_file *p, void *v) softirq =cputime64_add (softirq,kstat_cpu (i).cpustat.softirq); steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest); + guest_nice =cputime64_add (guest_nice, +kstat_cpu (i).cpustat.guest_nice);for_each_irq_nr (j) { sum +=kstat_irqs_cpu (j, i); }
@@ -65,7 +67,7 @@ static int show_stat(struct seq_file *p, void *v) } sum +=arch_irq_stat (); - seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", + seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", (unsigned long long)cputime64_to_clock_t(user), (unsigned long long)cputime64_to_clock_t(nice), (unsigned long long)cputime64_to_clock_t(system),
@@ -74,7 +76,8 @@ static int show_stat(struct seq_file *p, void *v) (unsigned long long )cputime64_to_clock_t (irq), (unsigned long long )cputime64_to_clock_t (softirq), (unsigned long long )cputime64_to_clock_t (steal), - (unsigned long long)cputime64_to_clock_t(guest)); + (unsigned long long )cputime64_to_clock_t (guest), + (unsigned long long)cputime64_to_clock_t(guest_nice));for_each_online_cpu (i) {/* Copy values here to work around gcc-2.95.3, gcc-2.96 */
@@ -88,8 +91,9 @@ static int show_stat(struct seq_file *p, void *v) softirq =kstat_cpu (i).cpustat.softirq; steal =kstat_cpu (i).cpustat.steal; guest =kstat_cpu (i).cpustat.guest; + guest_nice =kstat_cpu (i).cpustat.guest_nice; seq_printf(p, - "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", + "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", i, (unsigned long long)cputime64_to_clock_t(user), (unsigned long long)cputime64_to_clock_t(nice),
@@ -99,7 +103,8 @@ static int show_stat(struct seq_file *p, void *v) (unsigned long long )cputime64_to_clock_t (irq), (unsigned long long )cputime64_to_clock_t (softirq), (unsigned long long )cputime64_to_clock_t (steal), - (unsigned long long)cputime64_to_clock_t(guest)); + (unsigned long long )cputime64_to_clock_t (guest), + (unsigned long long)cputime64_to_clock_t(guest_nice)); }seq_printf (p,"intr %llu" , (unsigned long long )sum);
include/linux/kernel_stat.h +1 -0
@@ -25,6 +25,7 @@ struct cpu_usage_stat {cputime64_t iowait;cputime64_t steal;cputime64_t guest; +cputime64_t guest_nice; };struct kernel_stat {
kernel/sched.c +7 -2
@@ -5017,8 +5017,13 @@ static void account_guest_time(struct task_struct *p, cputime_t cputime, p->gtime =cputime_add (p->gtime, cputime);/* Add guest time to cpustat. */ - cpustat->user =cputime64_add (cpustat->user, tmp); - cpustat->guest =cputime64_add (cpustat->guest, tmp); +if (TASK_NICE (p) >0 ) { + cpustat->nice =cputime64_add (cpustat->nice, tmp); + cpustat->guest_nice =cputime64_add (cpustat->guest_nice, tmp); + }else { + cpustat->user =cputime64_add (cpustat->user, tmp); + cpustat->guest =cputime64_add (cpustat->guest, tmp); + } }/*
Signature · 1 line
1.6.2.5
Quoted 15 lines · Ryota Ozaki
Hi list,
(CC: Ingo and Avi)CPU time of a guest is always accounted in 'user' time without concern for the nice value of its counterpart process although the guest is scheduled under the nice value.
This patch fixes the defect and accounts cpu time of a niced guest in 'nice' time as same as a niced process.
And also the patch adds '
guest_nice' to cpuacct. The value provides niced guest cpu time which is like 'nice' to 'user'.
Quoted 5 lines
This patch has already reviewed and acked by Avi on KVM ML.
The original discussions can be found here.
http://www.mail-archive.com/[email protected]/msg23982.html
http://www.mail-archive.com/[email protected]/msg23860.html
your patch is line-wrapped and does not apply (possibly due to more whitespace damage).
Please consult Documentation/email-clients.txt and send a patch against latest -tip :
http://people.redhat.com/mingo/tip.git/README
Thanks,
Ingo
Quoted 2 lines · Ingo Molnar
your patch is line-wrapped and does not apply (possibly due to more whitespace damage).
Apologies for my bungle. I've resent the patch via git-send-email.
Thanks,
ozaki-r