From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61303C76192 for ; Tue, 16 Jul 2019 21:40:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3021821743 for ; Tue, 16 Jul 2019 21:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563313230; bh=DsJllMIph7rrpdefmAd2AzgdJy2cvJ1qoXgL7T7usRc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=1WlRkVsa8jP2Tp3CTnDna7WIEZJqKfu79NcWdMIITUYwoD8KmzlruDLCn+LddPTKA bVy6jrJFWY943ixhzWYkCNXhlwXB6MJd7L0CdeW3eCUDoAku6byApmjrBn7SOhh8D1 DNAvKbClMoUXqvgqWplMPNwQ6wFw2kzhUrorv39E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388387AbfGPVk2 (ORCPT ); Tue, 16 Jul 2019 17:40:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:54172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728235AbfGPVk2 (ORCPT ); Tue, 16 Jul 2019 17:40:28 -0400 Received: from localhost (lfbn-ncy-1-174-150.w83-194.abo.wanadoo.fr [83.194.254.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 17637206C2; Tue, 16 Jul 2019 21:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563313227; bh=DsJllMIph7rrpdefmAd2AzgdJy2cvJ1qoXgL7T7usRc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gT69QE+d5wzTTSXhV5hoXTFHOiN0EX47IbcE2DOtxiYNQReYbvTY8CGgt6YS2Vyq6 ugXB91GW9ykT//bPrcIOC4Q1Fg6oRQPe9cc2ML0j83sGuS/5J6mgbtHUj764WNdyXN r36J7y+AZ0/tB0Q7l8Fmf7XENBtk0t6WMHFTbnK0= Date: Tue, 16 Jul 2019 23:40:25 +0200 From: Frederic Weisbecker To: "Rafael J. Wysocki" Cc: Linux PM , Thomas Lindroth , LKML , Peter Zijlstra Subject: Re: [PATCH] cpuidle: Always stop scheduler tick on adaptive-tick CPUs Message-ID: <20190716214024.GA8345@lenoir> References: <6254683.2O5gIZElE2@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6254683.2O5gIZElE2@kreacher> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 16, 2019 at 05:25:10PM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Running the scheduler tick on idle adaptive-tick CPUs is not useful Judging by the below change, you mean full dynticks, right? > and it may also be not expected by users (as reported by Thomas), so > add a check to cpuidle_idle_call() to always stop the tick on them > regardless of the idle duration predicted by the governor. > > Fixes: 554c8aa8ecad ("sched: idle: Select idle state before stopping the tick") > Reported-by: Thomas Lindroth > Tested-by: Thomas Lindroth > Signed-off-by: Rafael J. Wysocki > --- > kernel/sched/idle.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > Index: linux-pm/kernel/sched/idle.c > =================================================================== > --- linux-pm.orig/kernel/sched/idle.c > +++ linux-pm/kernel/sched/idle.c > @@ -191,7 +191,8 @@ static void cpuidle_idle_call(void) > */ > next_state = cpuidle_select(drv, dev, &stop_tick); > > - if (stop_tick || tick_nohz_tick_stopped()) > + if (stop_tick || tick_nohz_tick_stopped() || > + !housekeeping_cpu(dev->cpu, HK_FLAG_TICK)) But tick_nohz_tick_stopped() also works on full dynticks CPUs. If the tick isn't stopped on a full dynticks CPU by the time we reach this path, it means that the conditions for the tick to be stopped are not met anyway (eg: more than one task and sched tick is needed, perf event requires the tick, posix CPU timer, etc...) Or am I missing something else? Thanks. > tick_nohz_idle_stop_tick(); > else > tick_nohz_idle_retain_tick(); > > >