Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753355AbcCHM35 (ORCPT ); Tue, 8 Mar 2016 07:29:57 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:38569 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752163AbcCHM3c (ORCPT ); Tue, 8 Mar 2016 07:29:32 -0500 Date: Tue, 8 Mar 2016 13:29:27 +0100 From: Frederic Weisbecker To: Chris Friesen Cc: Thomas Gleixner , John Stultz , Daniel Lezcano , lkml , Peter Zijlstra , Ingo Molnar , Rik van Riel Subject: Re: [PATCH v2] sched/cputime: steal_account_process_tick() should return jiffies Message-ID: <20160308122924.GB9122@lerouge> References: <56DA1339.5030601@mail.usask.ca> <20160305131856.GA4441@lerouge> <56DBAF6D.5010503@mail.usask.ca> <56DBBDB8.40305@mail.usask.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56DBBDB8.40305@mail.usask.ca> 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 Content-Length: 971 Lines: 24 On Sat, Mar 05, 2016 at 11:18:48PM -0600, Chris Friesen wrote: > The callers of steal_account_process_tick() expect it to return > whether a jiffy should be considered 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. > > If cputime has nsecs granularity and there is a tiny amount of > stolen time (a few nsecs, say) then we will consider the entire > tick stolen and will not account the tick on user/system/idle, > causing /proc/stats to show invalid data. > > The fix is to change steal_account_process_tick() to accumulate > the stolen time and only account it once it's worth a jiffy. > > (Thanks to Frederic Weisbecker for suggestions to fix a bug in my > first version of the patch.) > > Signed-off-by: Chris Friesen Acked-by: Frederic Weisbecker Thanks Chris!