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: 70296 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp179753qgy; Fri, 17 Jun 2016 02:14:22 -0700 (PDT) X-Received: by 10.66.12.102 with SMTP id x6mr1318657pab.151.1466154862813; Fri, 17 Jun 2016 02:14:22 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x72si11478221pff.224.2016.06.17.02.14.22; Fri, 17 Jun 2016 02:14:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755231AbcFQJOH (ORCPT + 14 others); 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 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(+) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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; }