Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757569AbZD2ILN (ORCPT ); Wed, 29 Apr 2009 04:11:13 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752691AbZD2IK5 (ORCPT ); Wed, 29 Apr 2009 04:10:57 -0400 Received: from mtagate6.de.ibm.com ([195.212.29.155]:45145 "EHLO mtagate6.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751508AbZD2IKz convert rfc822-to-8bit (ORCPT ); Wed, 29 Apr 2009 04:10:55 -0400 Date: Wed, 29 Apr 2009 10:08:40 +0200 From: Martin Schwidefsky To: Eric Dumazet Cc: Andrew Morton , Andrew Gallatin , linux-kernel@vger.kernel.org, rick.jones2@hp.com, brice@myri.com, Paul Mackerras , Benjamin Herrenschmidt , Ingo Molnar Subject: Re: [PATCH] sched: account system time properly Message-ID: <20090429100840.77359cae@skybase> In-Reply-To: <49F805C9.9070303@cosmosbay.com> References: <49F078FA.6010507@myri.com> <20090428163004.46733752.akpm@linux-foundation.org> <49F7DF44.8090907@cosmosbay.com> <49F805C9.9070303@cosmosbay.com> Organization: IBM Corporation X-Mailer: Claws Mail 3.7.0 (GTK+ 2.14.7; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1601 Lines: 51 On Wed, 29 Apr 2009 09:46:17 +0200 Eric Dumazet 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 > > 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? -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/