Received: by 10.223.185.116 with SMTP id b49csp6510668wrg; Thu, 8 Mar 2018 08:35:39 -0800 (PST) X-Google-Smtp-Source: AG47ELsWhrqw6qaprz/U3aiPAmOiBMa9qF32G8GI18+gLP9EvhGmWexIx8j/sB1wp0YpfuHtN20D X-Received: by 2002:a17:902:6c01:: with SMTP id q1-v6mr14845771plk.142.1520526939793; Thu, 08 Mar 2018 08:35:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520526939; cv=none; d=google.com; s=arc-20160816; b=M6SBJGUvBXekCbuXT0mXCuxoj7rwxaw/p6X/DkrWNOTTbiqcd4wO9CgnH05ncyl94i hNMw2SJIgwVZfA8AyP1UYPyuclgWTqGHdb+CyUkB5/RGRzdt3v1rsjvJoi7cFxty5ms1 rvPPhnzjL/E8LqJGnKXvc+mwOJNPt5xYczWNjy6EwNOsKF8YWeuKeo3ui6lmN0XwY3+W D3uojrkODIngtI9wtB8exFidD2Id46wNN7dkDDlc4J46mWXs5QEOJBbyMkZanINuoGth +j9E2qmDPBeQrDjq3mSaG9Ds6N/KU4mRC5XvJbydo8igyqQ5Q5jZM39G1LDfKEWqxRIa KcTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=9veof2dd/WxTBuV44EmBBtmClknACftT+/0V+HhLuiE=; b=ACzGJP9yp6w+sXBX7ii3eWRV6Qn9yMMcHSMA+/zLWBSWXPXK0vMK4/8PpAsWbckAq7 T6XTiRUt+hXnOlaCStb86wXLQtbNUAA7dzm26gPi2zzGLkmVWH9L8FTgvyXNx5zaFQvZ TjmtFhzSpg1qE1giLSGcpkK89wj2EcoNE/am6x3ZhLEygWZt7aBsJfn/hPdACA0a+Zeb PPAqwEm6nZT52klTYryYSmnq6Fy5WqzzMf+nyOoxd1pcUi0l1z/E/T7SpJZHjGMGlFew mKWSR01KuOmIle2itb7syc9sz9cUeGswLyY7C12JAPvaNFGQxxjpMIhvXuu9M4AunJVH tLjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=U8E9ad8z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t64si245431pgc.584.2018.03.08.08.35.24; Thu, 08 Mar 2018 08:35:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=U8E9ad8z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934924AbeCHQeX (ORCPT + 99 others); Thu, 8 Mar 2018 11:34:23 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:34794 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754612AbeCHQeV (ORCPT ); Thu, 8 Mar 2018 11:34:21 -0500 Received: by mail-ot0-f193.google.com with SMTP id n74so5967557ota.1; Thu, 08 Mar 2018 08:34:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=9veof2dd/WxTBuV44EmBBtmClknACftT+/0V+HhLuiE=; b=U8E9ad8zZw70Eip0zaFu33exlfbri+YRXYpnVoU20wQwi6nVReZwVvpUp2iyCo0DNx ydX55hmhe085EWLLhrgu3BSHfAgfICrAYBiEjqIlUPDukj6aJfPF5JQMIQqatkigh+I7 bJojZOZWUnK6P/vh/PslIAlREVtE5pUgZz0M/OIbyUmEwwqaKzfMX4nfI7B0C77tuXOU +VXuElr0HmHyxwvGUozmc6+dvB7NilJ1nJqYP5ruQrdkOwU99cW/fe1mAxwDAbHf46nV hAAIPr2amS3ZdjpK4Zgt8xMdrJtX8f9mKKW7cOKtpAoXh1TJuR8fupnwN+X9jHUdNG21 0ryQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=9veof2dd/WxTBuV44EmBBtmClknACftT+/0V+HhLuiE=; b=VVH4+fbt0b7tEtnBlfXU0FqCsse1nuJOXbG9yLEQuOM0elskUmRfpSEpJBX/0/dwPm 2/0KdxfF6Gu8G+wcOibS658RZ+PO+UPyUXVjNw8wDzoDFBjysCn+PIj8xSXVKF/7wiqS OQIvX689Ftktdy2Yfidw/4CTr/3s/4+sFydEv3n0sSay9mM1gAhVI5Gv3+4sRR713c5l YnmAXCpJ9WV8Irl8zWJxTZ6H3Q9jcpf7sMHH7+7pZRleFdA4Rs6T2qfJL18z7bUoGBPq 9hu6nNn9gdLph+JJjvsPLNzs+EaR08bcYYRcc6wrdBA9I19gBFovmanIT8Ad62t38lFH Qb2w== X-Gm-Message-State: AElRT7HUnJxG7VE/ghNVreWIs1D0ekqRtjKajJ3M8aPi7Xud1hq3ow/k YigOyzDtdtwRA5ZELQEeX0ADY6rzzsxU+ho6tJM= X-Received: by 10.157.40.101 with SMTP id h34mr18013392otd.364.1520526861038; Thu, 08 Mar 2018 08:34:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.44.146 with HTTP; Thu, 8 Mar 2018 08:34:20 -0800 (PST) In-Reply-To: <20180308151407.GA11118@lerouge> References: <2067762.1uWBf5RSRc@aspire.rjw.lan> <4136227.b9g9WnMbNJ@aspire.rjw.lan> <20180307231827.GA9367@lerouge> <1938066.lrFpnYERYl@aspire.rjw.lan> <20180308151407.GA11118@lerouge> From: "Rafael J. Wysocki" Date: Thu, 8 Mar 2018 17:34:20 +0100 X-Google-Sender-Auth: ShXg5IOG3qpBLXntr82LfmiGVgM Message-ID: Subject: Re: [RFC/RFT][PATCH v2 1/6] time: tick-sched: Reorganize idle tick management code To: Frederic Weisbecker Cc: "Rafael J. Wysocki" , Peter Zijlstra , Linux PM , Thomas Gleixner , Frederic Weisbecker , Paul McKenney , Thomas Ilsche , Doug Smythies , Rik van Riel , Aubrey Li , Mike Galbraith , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 8, 2018 at 4:14 PM, Frederic Weisbecker wrote: > On Thu, Mar 08, 2018 at 10:22:26AM +0100, Rafael J. Wysocki wrote: >> On Thursday, March 8, 2018 12:18:29 AM CET Frederic Weisbecker wrote: >> > On Tue, Mar 06, 2018 at 10:02:01AM +0100, Rafael J. Wysocki wrote: >> > > Index: linux-pm/kernel/time/tick-sched.c >> > > =================================================================== >> > > --- linux-pm.orig/kernel/time/tick-sched.c >> > > +++ linux-pm/kernel/time/tick-sched.c >> > > + >> > > +/** >> > > + * tick_nohz_idle_prepare - prepare for entering idle on the current CPU. >> > > + * >> > > + * Called when we start the idle loop. >> > > + */ >> > > +void tick_nohz_idle_prepare(void) >> > > +{ >> > > + struct tick_sched *ts; >> > > + >> > > + __tick_nohz_idle_prepare(); >> > > + >> > > + local_irq_disable(); >> > > + >> > > + ts = this_cpu_ptr(&tick_cpu_sched); >> > > + ts->inidle = 1; >> > > + >> > > + local_irq_enable(); >> > > +} >> > >> > Why not calling tick_nohz_start_idle() from there? This is going to >> > simplify the rest, you won't need to call tick_nohz_idle_go_idle() >> > from places that don't want to stop the tick and you can then remove >> > the stop_tick argument. >> >> So I guess I would then use ts->idle_entrytime as "now" in the >> tick_nohz_get_sleep_length() computation, right? > > Ah right, I missed the need for ktime_get(). > > You can't use ts->idle_entrytime in tick_nohz_get_sleep_length() because > full dynticks doesn't rely on it. > > But I think you can just do the following, with a comment explaining that > idle_entrytime is expected to be fresh enough at this point: > > diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c > index 57b3de4..8e61796 100644 > --- a/kernel/time/tick-sched.c > +++ b/kernel/time/tick-sched.c > @@ -923,7 +923,7 @@ static void __tick_nohz_idle_enter(struct tick_sched *ts, bool stop_tick) > > ts->idle_calls++; > > - expires = tick_nohz_stop_sched_tick(ts, now, cpu); > + expires = tick_nohz_stop_sched_tick(ts, ts->idle_entrytime, cpu); > if (expires > 0LL) { > ts->idle_sleeps++; > ts->idle_expires = expires; > That's what I was thinking about, but ktime_get() seems to be working too.