Received: by 10.213.65.68 with SMTP id h4csp326627imn; Fri, 6 Apr 2018 00:25:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx49zOgs4Uf/JyDi2GBkLoG4IoWfpan8jFDH4IssPJZ79aI8654QZgF2wedC5Ol0prkKKA5wJ X-Received: by 10.101.64.7 with SMTP id f7mr17147950pgp.216.1522999558093; Fri, 06 Apr 2018 00:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522999558; cv=none; d=google.com; s=arc-20160816; b=MXc9AAiwkSahDloeAxUwoewN42ayTvKwTawfcW2zjUJyFKwct20cmV/j/8DoMzIIhJ JKUrQRerPJbyYIvPex5ZoLW+KXGFkxq1gAg/GKjhI6TDU5ZFFjdUWZ9v5MGrEmDHIXmX 5TAVRe4/ws/YVnVrzxD8ct+deBpoNXzBmwVkMxxm+vjaH9nAC2YvEEP9BfPx+CfEo75m d4gLcNaYEQiyzErf//zWPvs8Ff+r3q0GlQJQYTIclw/ZnRHnflML9fFNjJLeD+efa2yC CdE8af5RA4BL1QKGMFXzwT6jMjM/pKSJpAcl8Lo0iU+v6+OjmVssBGxeGfHjePgyPrBo rcWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=wrTN1cHFsTUy+g7WNjmTy3tPCnjrJN2EZ+oScxHzvW8=; b=CKuJXCEjvxt8Eh9n9KirRWaCli8L06Q0jlsDi39TLmuVCO2FIGUvHAHH3ioKrBNclF JjQKgNznRAMdLlx41F6UYDClk+SJOkj35zdA8MAkAEJe9c2qKdHH4EdVdjsdHhzIwHH4 JXfw3mbXvACvGWARt7iHKlFbJjhfRVizdi90/RxTRzuB/+ZX351L3MdWBrmdIGJwrsa7 8ALAoqBsELkQ0B4CyqTeh6cPKsMfdEdA05BDeQW1dy8mxcwlWrYwJxa5WFrMv7K3p8N0 QlSEI4volj/EZTJH2rw9WCqJPqikvBmmKla3tf6xbN4N7AT3E3zuoTULzUwQn4Fke7S7 n9eQ== ARC-Authentication-Results: i=1; mx.google.com; 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 x4-v6si8196484plr.391.2018.04.06.00.25.44; Fri, 06 Apr 2018 00:25:58 -0700 (PDT) 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; 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 S1751711AbeDFHYd (ORCPT + 99 others); Fri, 6 Apr 2018 03:24:33 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:49461 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751367AbeDFHYc (ORCPT ); Fri, 6 Apr 2018 03:24:32 -0400 Received: from 79.184.255.92.ipv4.supernova.orange.pl (79.184.255.92) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83) id b1fa2c9d1061caed; Fri, 6 Apr 2018 09:24:30 +0200 From: "Rafael J. Wysocki" To: Frederic Weisbecker Cc: Linux PM , Peter Zijlstra , Frederic Weisbecker , Thomas Gleixner , Paul McKenney , Thomas Ilsche , Doug Smythies , Rik van Riel , Aubrey Li , Mike Galbraith , LKML , Len Brown Subject: Re: [PATCH v9 05/10] cpuidle: Return nohz hint from cpuidle_select() Date: Fri, 06 Apr 2018 09:24:42 +0200 Message-ID: <1694033.ykrRIB27yN@aspire.rjw.lan> In-Reply-To: <20180406024413.GB4400@lerouge> References: <1736751.LdhZHb50jq@aspire.rjw.lan> <5818594.T4StF86Hkt@aspire.rjw.lan> <20180406024413.GB4400@lerouge> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday, April 6, 2018 4:44:14 AM CEST Frederic Weisbecker wrote: > On Wed, Apr 04, 2018 at 10:39:50AM +0200, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > Index: linux-pm/kernel/time/tick-sched.c > > =================================================================== > > --- linux-pm.orig/kernel/time/tick-sched.c > > +++ linux-pm/kernel/time/tick-sched.c > > @@ -991,6 +991,20 @@ void tick_nohz_irq_exit(void) > > } > > > > /** > > + * tick_nohz_idle_got_tick - Check whether or not the tick handler has run > > + */ > > +bool tick_nohz_idle_got_tick(void) > > +{ > > + struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); > > + > > + if (ts->inidle > 1) { > > + ts->inidle = 1; > > + return true; > > + } > > + return false; > > +} > > + > > +/** > > * tick_nohz_get_sleep_length - return the length of the current sleep > > * > > * Called from power state control code with interrupts disabled > > @@ -1101,6 +1115,9 @@ static void tick_nohz_handler(struct clo > > struct pt_regs *regs = get_irq_regs(); > > ktime_t now = ktime_get(); > > > > + if (ts->inidle) > > + ts->inidle = 2; > > + > > You can move that to tick_sched_do_timer() to avoid code duplication. Right. > Also these constants are very opaque. And even with proper symbols it wouldn't look > right to extend ts->inidle that way. Well, this was a Peter's idea. :-) > Perhaps you should add a field such as ts->got_idle_tick under the boolean fields > after the below patch: OK, but at this point I'd prefer to make such changes on top of the existing set, because that's got quite some testing coverage already and honestly this is cosmetics in my view (albeit important). > -- > From c7b2ca5a4c512517ddfeb9f922d5999f82542ced Mon Sep 17 00:00:00 2001 > From: Frederic Weisbecker > Date: Fri, 6 Apr 2018 04:32:37 +0200 > Subject: [PATCH] nohz: Gather tick_sched booleans under a common flag field > > This optimize the space and leave plenty of room for further flags. > > Signed-off-by: Frederic Weisbecker > --- > kernel/time/tick-sched.h | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/kernel/time/tick-sched.h b/kernel/time/tick-sched.h > index 954b43d..38f24dc 100644 > --- a/kernel/time/tick-sched.h > +++ b/kernel/time/tick-sched.h > @@ -45,14 +45,17 @@ struct tick_sched { > struct hrtimer sched_timer; > unsigned long check_clocks; > enum tick_nohz_mode nohz_mode; > + > + unsigned int inidle : 1; > + unsigned int tick_stopped : 1; > + unsigned int idle_active : 1; > + unsigned int do_timer_last : 1; > + > ktime_t last_tick; > ktime_t next_tick; > - int inidle; > - int tick_stopped; > unsigned long idle_jiffies; > unsigned long idle_calls; > unsigned long idle_sleeps; > - int idle_active; > ktime_t idle_entrytime; > ktime_t idle_waketime; > ktime_t idle_exittime; > @@ -62,7 +65,6 @@ struct tick_sched { > unsigned long last_jiffies; > u64 next_timer; > ktime_t idle_expires; > - int do_timer_last; > atomic_t tick_dep_mask; > }; > >