Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760624AbcCEK2h (ORCPT ); Sat, 5 Mar 2016 05:28:37 -0500 Received: from www.linutronix.de ([62.245.132.108]:39462 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759541AbcCEK23 (ORCPT ); Sat, 5 Mar 2016 05:28:29 -0500 Date: Sat, 5 Mar 2016 11:27:01 +0100 (CET) From: Thomas Gleixner To: Chris Friesen cc: John Stultz , Daniel Lezcano , Frederic Weisbecker , lkml , Peter Zijlstra , Ingo Molnar , Rik van Riel Subject: Re: [PATCH] steal_account_process_tick() should return jiffies In-Reply-To: <56DA1339.5030601@mail.usask.ca> Message-ID: References: <56DA1339.5030601@mail.usask.ca> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1657 Lines: 53 Chris, On Fri, 4 Mar 2016, Chris Friesen wrote: First of all the subject line should contain a subsystem prefix, i.e. "sched/cputime:" > The callers of steal_account_process_tick() expect it to return whether > the last jiffy was stolen or not. > > Currently the return value of steal_account_process_tick() is in units > of cputime, which vary between either jiffies or nsecs depending on > CONFIG_VIRT_CPU_ACCOUNTING_GEN. Sure, but what is the actual problem? The return value is boolean and tells whether there was stolen time accounted or not. > The fix is to change steal_account_process_tick() to always return > jiffies. If CONFIG_VIRT_CPU_ACCOUNTING_GEN is not enabled then this > is a no-op. What does that fix? > As far as I can tell this bug has been present since commit dee08a72. Which bug? > Signed-off-by: Chris Friesen > --- > > kernel/sched/cputime.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c > index b2ab2ff..e724496 100644 > --- a/kernel/sched/cputime.c > +++ b/kernel/sched/cputime.c > @@ -276,7 +276,7 @@ static __always_inline bool steal_account_process_tick(void) > this_rq()->prev_steal_time += cputime_to_nsecs(steal_ct); > > account_steal_time(steal_ct); > - return steal_ct; > + return cputime_to_jiffies(steal_ct); So if steal time is close to a jiffie, then cputime_to_jiffies will return 0 and you account a full jiffie to user/system/whatever. Without a proper explanation of the problem and the resulting "bug" I really cannot figure out why we want that change. Thanks, tglx