From patchwork Thu Jun 9 07:34:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaoyang Huang X-Patchwork-Id: 9166393 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 06A3760832 for ; Thu, 9 Jun 2016 07:36:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB24728307 for ; Thu, 9 Jun 2016 07:36:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFBDB28328; Thu, 9 Jun 2016 07:36:14 +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 7F42328307 for ; Thu, 9 Jun 2016 07:36:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425318AbcFIHgF (ORCPT ); Thu, 9 Jun 2016 03:36:05 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34791 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423277AbcFIHgE (ORCPT ); Thu, 9 Jun 2016 03:36:04 -0400 Received: by mail-pa0-f44.google.com with SMTP id bz2so10457978pad.1 for ; Thu, 09 Jun 2016 00:36:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:from:to:subject:date:in-reply-to:references; bh=zGKU8cZiGYiyBAdHQNIj8PPwWBU3OImCyTgJhHNhfO8=; b=SefmvUCwnT2qjfcHj8ef6nK6KeisgTKOvRvNDdiYDon4MkatS8HgA0FpNyEPu7aNMv qvv+bY8R4O3aXYCK4v9yrfLxUUkQsOQZT4LQF6MN0G3NSZGUpmvVdyYayLUzJjuN5q3J Af2ZYP5ISVqjkiUCird2H+dB8/OUWCn+k5gxw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:subject:date:in-reply-to :references; bh=zGKU8cZiGYiyBAdHQNIj8PPwWBU3OImCyTgJhHNhfO8=; b=HE3hz8AIu59VQoG9W0xPdFaUPD2LK7P2JgGWHPjwpNL4ddXJlr2gHmMQv4I/y+KLoX 0i3/Qu4viJ7Ax4clYrNdEde/ijBgsseEC2o9utWSSEMa0yh0QfUPg1E3qhCDzIDeeq2Z dCZgRnr+ayVlcOoNwf4IKxGNon/BA1cln9/hOkboMuOTcWktXLhM9DA+wdN3sKGhNaDt vxcKWOSSgb0gEIogx4feiUe/E6qHgr9ZO1h3l25brloDrj2frpysmCJGIrPo8HOz3d7t 4RFzlv6tBH3JC4JCUmc8WcO7D7PymwzIOskacGogHe+JeV56NdbtBo6LL6y+qgkCRZSE al8A== X-Gm-Message-State: ALyK8tJxHrWwoJVTj95XH9zhH72cHncvLfXAFGZZYfSWiZaLd/CKQRg+h79wM7XQpuHgWN8P X-Received: by 10.66.22.134 with SMTP id d6mr10871256paf.35.1465457758789; Thu, 09 Jun 2016 00:35:58 -0700 (PDT) Received: from zyhuangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id r85sm7438021pfr.48.2016.06.09.00.35.56 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Jun 2016 00:35:58 -0700 (PDT) Message-ID: <57591c5e.582b620a.f8dc2.19dd@mx.google.com> X-Google-Original-Message-ID: <1465457684-9848-2-git-send-email-y> From: zhaoyang.huang@linaro.org X-Google-Original-From: y 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: [RFC PATCH v2 2/2] power/idle: enhance the precision of sleep_length Date: Thu, 9 Jun 2016 15:34:44 +0800 X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1465457684-9848-1-git-send-email-y> References: <1465457684-9848-1-git-send-email-y> 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 From: Zhaoyang Huang 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; }