Skip to content

Commit

Permalink
sched: fix accounting of interrupts during guest execution on s390
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christian Borntraeger authored and Ingo Molnar committed Nov 15, 2007
1 parent 99fee6d commit 9778385
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -3390,10 +3390,8 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
struct rq *rq = this_rq();
cputime64_t tmp;

if (p->flags & PF_VCPU) {
account_guest_time(p, cputime);
return;
}
if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0))
return account_guest_time(p, cputime);

p->stime = cputime_add(p->stime, cputime);

Expand Down

0 comments on commit 9778385

Please sign in to comment.