public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andrew Gallatin <gallatin@myri.com>,
	linux-kernel@vger.kernel.org, rick.jones2@hp.com, brice@myri.com,
	Paul Mackerras <paulus@samba.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] sched: account system time properly
Date: Wed, 29 Apr 2009 11:20:03 +0200	[thread overview]
Message-ID: <49F81BC3.2050805@cosmosbay.com> (raw)
In-Reply-To: <20090429100840.77359cae@skybase>

Martin Schwidefsky a écrit :
> On Wed, 29 Apr 2009 09:46:17 +0200
> Eric Dumazet <dada1@cosmosbay.com> wrote:
> 
>> Eric Dumazet a écrit :
>>> Andrew Morton a écrit :
>>>
>>> So, if IRQs are interrupting idle task, I guess if (p != rq->idle) will be false.
>>>
> 
> If an IRQ interrupts the idle task the tick is supposed to be accounted
> as an idle tick. Only if the IRQ interrupted the system while it has
> been in hardirq or softirq processing then it should be accounted as
> system tick.
> 
>> Maybe following patch is needed ?
>>
>> [PATCH] sched: account system time properly
>>
>> When idle task is interrupted by an IRQ, time accounting considers CPU is idle,
>> even while it should account for hard or softirq.
>>
>> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
>>
>> diff --git a/kernel/sched.c b/kernel/sched.c
>> index b902e58..26efa47 100644
>> --- a/kernel/sched.c
>> +++ b/kernel/sched.c
>> @@ -4732,7 +4732,7 @@ void account_process_tick(struct task_struct *p, int user_tick)
>>  
>>  	if (user_tick)
>>  		account_user_time(p, one_jiffy, one_jiffy_scaled);
>> -	else if (p != rq->idle)
>> +	else if ((p != rq->idle) || (irq_count() != HARDIRQ_OFFSET))
>>  		account_system_time(p, HARDIRQ_OFFSET, one_jiffy,
>>  				    one_jiffy_scaled);
>>  	else
> 
> That patch makes a lot of sense to me. Does it fix the problem?
> 

Yes it does, on my machine at least :

11:18:48 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
11:18:58 AM  all    0.00    0.00    0.00    0.00    0.21    0.69    0.00    0.00   99.10
11:18:58 AM    0    0.00    0.00    0.00    0.00    1.70    5.50    0.00    0.00   92.80  << HERE >>
11:18:58 AM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11:18:58 AM    2    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11:18:58 AM    3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11:18:58 AM    4    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11:18:58 AM    5    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11:18:58 AM    6    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11:18:58 AM    7    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00




  reply	other threads:[~2009-04-29  9:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-23 14:19 IRQ / SoftIRQ CPU time accounting broken by 457533a7d3402d1d91fbc125c8bd1bd16dcd3cd4 Andrew Gallatin
2009-04-28 23:30 ` Andrew Morton
2009-04-29  5:01   ` Eric Dumazet
2009-04-29  7:46     ` [PATCH] sched: account system time properly Eric Dumazet
2009-04-29  8:08       ` Martin Schwidefsky
2009-04-29  9:20         ` Eric Dumazet [this message]
2009-04-29  9:48           ` Martin Schwidefsky
2009-04-29 10:24             ` Ingo Molnar
2009-04-29 12:44               ` Eric Dumazet
2009-04-29 13:09                 ` [tip:sched/urgent] " tip-bot for Eric Dumazet
2009-04-29 14:58                   ` Andrew Morton
2009-04-29 19:06                     ` Ingo Molnar
2009-04-29 13:23                 ` [PATCH] " Andrew Gallatin
2009-04-29  8:02   ` IRQ / SoftIRQ CPU time accounting broken by 457533a7d3402d1d91fbc125c8bd1bd16dcd3cd4 Martin Schwidefsky

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=49F81BC3.2050805@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=brice@myri.com \
    --cc=gallatin@myri.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=rick.jones2@hp.com \
    --cc=schwidefsky@de.ibm.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