Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760522AbcCDXHT (ORCPT ); Fri, 4 Mar 2016 18:07:19 -0500 Received: from smtp-out-so.shaw.ca ([64.59.136.137]:54777 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760351AbcCDXHR (ORCPT ); Fri, 4 Mar 2016 18:07:17 -0500 X-Greylist: delayed 487 seconds by postgrey-1.27 at vger.kernel.org; Fri, 04 Mar 2016 18:07:16 EST X-Authority-Analysis: v=2.1 cv=VIR9547X c=1 sm=1 tr=0 a=b4X6fhI4x5MOnsgcuOa5CA==:117 a=b4X6fhI4x5MOnsgcuOa5CA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=IkcTkHD0fZMA:10 a=t7CeM3EgAAAA:8 a=ZAIEDoFu8RPF4zdGpPwA:9 a=QEXdDO2ut3YA:10 Message-ID: <56DA1339.5030601@mail.usask.ca> Date: Fri, 04 Mar 2016 16:59:05 -0600 From: Chris Friesen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: John Stultz , Thomas Gleixner , Daniel Lezcano , Frederic Weisbecker , lkml Subject: [PATCH] steal_account_process_tick() should return jiffies Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfLScV3IOLTswLS/rrWkZJO7GPu1Xo1RhJeovPCZydeN1mrJA7W9o+DIMzRiebyGTz8630eBbq3Jc6ODzx0bIskmiAOsu8Gt8VyqamX7D5mivhrtJ3pG/ uM8puhlNIJ6icwdOSABMR6Ef6spTggCD1+6RAOGwcrRNAx/naBbREJwzbjwZI0e+p8ATBHBcMONtXFi9A9fXU1wTO2Wag3kUehPT9T0xGBtiu5CBjktSwBF+ xF7M6nsePOkOon+8YjMW4J6ejxKOiFTrLGyIt3awVqP/Orsdme3rSOFnuxZgOo1mOuLRiG42n6V0HqdrU5W/Ow== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1064 Lines: 32 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. 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. As far as I can tell this bug has been present since commit dee08a72. 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); } #endif return false;