aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2007-11-15 14:57:39 -0500
committerIngo Molnar <mingo@elte.hu>2007-11-15 14:57:39 -0500
commit9778385db35a799d410039be123044a0d3e917a2 (patch)
tree20564e6fabb5bdd86a13fc56ae0a6c880a9ccf6e /kernel/sched.c
parent99fee6d7e5748d96884667a4628118f7fc130ea0 (diff)
sched: fix accounting of interrupts during guest execution on s390
Currently the scheduler checks for PF_VCPU to decide if this timeslice has to be accounted as guest time. On s390 host interrupts are not disabled during guest execution. This causes theses interrupts to be accounted as guest time if CONFIG_VIRT_CPU_ACCOUNTING is set. Solution is to check if an interrupt triggered account_system_time. As the tick is timer interrupt based, we have to subtract hardirq_offset. I tested the patch on s390 with CONFIG_VIRT_CPU_ACCOUNTING and on x86_64. Seems to work. CC: Avi Kivity <avi@qumranet.com> CC: Laurent Vivier <Laurent.Vivier@bull.net> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 4fb3532dd7e8..908335e1781a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3390,10 +3390,8 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
3390 struct rq *rq = this_rq(); 3390 struct rq *rq = this_rq();
3391 cputime64_t tmp; 3391 cputime64_t tmp;
3392 3392
3393 if (p->flags & PF_VCPU) { 3393 if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0))
3394 account_guest_time(p, cputime); 3394 return account_guest_time(p, cputime);
3395 return;
3396 }
3397 3395
3398 p->stime = cputime_add(p->stime, cputime); 3396 p->stime = cputime_add(p->stime, cputime);
3399 3397