From patchwork Fri Jun 17 09:13:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaoyang Huang X-Patchwork-Id: 9183113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E8F8260776 for ; Fri, 17 Jun 2016 09:14:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFF0327E33 for ; Fri, 17 Jun 2016 09:14:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4E2828396; Fri, 17 Jun 2016 09:14:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B2BC27E33 for ; Fri, 17 Jun 2016 09:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755231AbcFQJOH (ORCPT ); Fri, 17 Jun 2016 05:14:07 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:33434 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755123AbcFQJOD (ORCPT ); Fri, 17 Jun 2016 05:14:03 -0400 Received: by mail-pa0-f45.google.com with SMTP id b13so26932160pat.0 for ; Fri, 17 Jun 2016 02:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=Gy39vAGq+fcOVdC8ZRLKCjqoa5Au+5/XkyiW3bHFF/E=; b=JbUOVID+I9PNyToiKip1/oWqRtShNOYWBKRlGpN5InuRbX/ZmO+ML4UdHsIgSNhMbp O6348JfzekV3ISfC7EGHA9pXnHrkpvLRywNB6+IqDHhxOnfW8Ib4WQ1N62osML0hwnOB jy7oIqvqHdzWE8aHkQg0TEA2feBgRVFEsAshA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Gy39vAGq+fcOVdC8ZRLKCjqoa5Au+5/XkyiW3bHFF/E=; b=iUyNzXfA/86PESTs9SimdjY/JztY+t+Fin7MLo+KupOQnZ9YFTQFP2Xyofd5ZnBTpv DVvGwROV51qKP79a8SzHdxDUdZAq4DUPBXmMZiToJWlkpBjWSPD4hEsYkg8PzalE5/A9 Rv9EZwyXAQInYRJG1bU4FhXXAk28BI4iLLWlgAYZ9wsqEFd58rrS4bW1yJO86HKMwGLO aLD/L8CFtLoblTnAzp/PkmZD6vhyfYkBLpgrsRHBcdz0vEcfG/4KfY5NvOZnechwIQw4 MjAKHpCnbMLW0fXUR4YhDoh41M7u+EOG+HQztKUEggT7NPQvy1/oWO+SrHFUA2CxLD1R qKHg== X-Gm-Message-State: ALyK8tKbK0VfGRV8BCTxgaHIYW3wUnePjiCgeseWL9he0oMPPSGpvRKMLVykQF5iOIkg6EQh X-Received: by 10.66.151.71 with SMTP id uo7mr1351126pab.134.1466154842181; Fri, 17 Jun 2016 02:14:02 -0700 (PDT) Received: from bj03382pcu.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id 7sm37356841pfa.28.2016.06.17.02.13.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jun 2016 02:14:00 -0700 (PDT) From: Zhaoyang Huang X-Google-Original-From: Zhaoyang Huang To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, zhaoyang.huang@spreadtrum.com, tglx@linutronix.de Subject: [RESEND PATCH v2 2/2] power/idle: enhance the precision of sleep_length Date: Fri, 17 Jun 2016 17:13:36 +0800 Message-Id: <1466154816-17900-2-git-send-email-zhaoyang.huang@spreadtrum.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1466154816-17900-1-git-send-email-zhaoyang.huang@spreadtrum.com> References: <1466154816-17900-1-git-send-email-zhaoyang.huang@spreadtrum.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There should be a gap between tick_nohz_idle_enter and tick_nohz_get_sleep_length when idle, which will cause the sleep_length is not very precised. Change it in this patch. Signed-off-by: Zhaoyang Huang --- kernel/time/tick-sched.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 536ada8..ee3be3d 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -975,6 +975,11 @@ void tick_nohz_irq_exit(void) ktime_t tick_nohz_get_sleep_length(void) { struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); + struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); + ktime_t now; + + now = ktime_get(); + ts->sleep_length = ktime_sub(dev->next_event, now); return ts->sleep_length; }