From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932889AbcGEOBp (ORCPT ); Tue, 5 Jul 2016 10:01:45 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34719 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753733AbcGEOA5 (ORCPT ); Tue, 5 Jul 2016 10:00:57 -0400 Date: Tue, 5 Jul 2016 16:00:54 +0200 From: Frederic Weisbecker To: Rik van Riel Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@kernel.org, pbonzini@redhat.com, fweisbec@redhat.com, wanpeng.li@hotmail.com, efault@gmx.de, tglx@linutronix.de, rkrcmar@redhat.com Subject: Re: [PATCH 1/4] sched,time: count actually elapsed irq & softirq time Message-ID: <20160705140053.GB5332@lerouge> References: <1467315350-3152-1-git-send-email-riel@redhat.com> <1467315350-3152-2-git-send-email-riel@redhat.com> <20160705124033.GA5332@lerouge> <1467724096.17336.41.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1467724096.17336.41.camel@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 05, 2016 at 09:08:16AM -0400, Rik van Riel wrote: > On Tue, 2016-07-05 at 14:40 +0200, Frederic Weisbecker wrote: > > On Thu, Jun 30, 2016 at 03:35:47PM -0400, riel@redhat.com wrote: > > > diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c > > > index 3d60e5d76fdb..018bae2ada36 100644 > > > --- a/kernel/sched/cputime.c > > > +++ b/kernel/sched/cputime.c > > > @@ -79,40 +79,50 @@ void irqtime_account_irq(struct task_struct > > > *curr) > > >  } > > >  EXPORT_SYMBOL_GPL(irqtime_account_irq); > > >   > > > -static int irqtime_account_hi_update(void) > > > +static cputime_t irqtime_account_hi_update(cputime_t maxtime) > > >  { > > >   u64 *cpustat = kcpustat_this_cpu->cpustat; > > >   unsigned long flags; > > > - u64 latest_ns; > > > - int ret = 0; > > > + cputime_t irq_cputime; > > >   > > >   local_irq_save(flags); > > > - latest_ns = this_cpu_read(cpu_hardirq_time); > > > - if (nsecs_to_cputime64(latest_ns) > cpustat[CPUTIME_IRQ]) > > > - ret = 1; > > > + irq_cputime = > > > nsecs_to_cputime(this_cpu_read(cpu_hardirq_time)) - > > > +       cpustat[CPUTIME_IRQ]; > > > > We might want to keep nsecs_to_cputime64(). If cputime_t == jiffies_t > > == unsigned long, > > we may have a problem after 49 days of interrupts. Arguably that's a > > lot of IRQs > > but lets be paranoid. > > The macro nsecs_to_cputime64 is only defined in > cputime_jiffies.h though, not in cputime_nsecs.h Ah indeed. > Want me to add a #define to the second file? Yes please. It should be a simple cast. Thanks!