Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3741864imm; Mon, 20 Aug 2018 04:04:43 -0700 (PDT) X-Google-Smtp-Source: AA+uWPy0vwOG0g1HRhYGP6/S342ImwD5FmAu9WXGIN6jdDRiJMcGo5oYTeFZgjmBJi59/Ujk0muT X-Received: by 2002:a65:5004:: with SMTP id f4-v6mr42523995pgo.54.1534763083507; Mon, 20 Aug 2018 04:04:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534763083; cv=none; d=google.com; s=arc-20160816; b=Z3msy/3Pcgo6GKmU+KnKu/s7Vg01svVaR01hG6/v1FgeSZQja7mcmjy0Arq9Ns9MqB zSPrGoGRnQOiYme8ML7HWqsvxi4LNamkAnY13QXxuGExq6DMYctgq9VEkwpb9AN1TMJc Vhqyi5KVLihIF9SCvu6/qg4dtUB9f5d1Njmosfg/HZPXJaKJFgnV72R7kqg8nPOTkiZj K34jMI80U5XpBZ4V/votWnCGn+W3MqL8uZ4Yzy5z4IAAw5LVI1sEBc4W4R6fIVLJH+kd Prpu/oRWjEpgKQAKG0LjoNKYtOiUdRWBmQSqNDo7/WJBYKO0wJqETaW0kel1B+a90Jc8 qn+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=pt1XV7TMguPjcBhIviy74GSY8GGerSZJ83xEDpix5Ak=; b=OIoDW/cIF0dSRqCYuf1gkouzUID8gww3ZYbyRKg4mWFs7v62CvjzRJwv5LLcmn+sPz NugTtVSnWFnPgigURcCVXonViHExaD8Fi7WpieQsidpJrTrJrQxuaEVtItv4tVU8El5K 8UFxNZXPZI34ogtngFWQ5EmxNVlgU2dFoLhWuB/hQGmz2VvMgilMSzovY9ILR1KMwUJa t5KS/xGI1XawCeRtw8/RSdZsq9yESWfgWVuCeOhODWsCKYquhe57ja60SZVIn0JJ1Y1Q 8gZEeyTvxl2sAu1ieFu69z90H3x68kgHSx4gBAm/CIy4wDnApgLFfJR1EYVdC8LI3GCy FZ8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ZW1fmKnL; 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 m20-v6si8708298pgv.383.2018.08.20.04.04.28; Mon, 20 Aug 2018 04:04:43 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ZW1fmKnL; 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 S1726391AbeHTOSM (ORCPT + 99 others); Mon, 20 Aug 2018 10:18:12 -0400 Received: from merlin.infradead.org ([205.233.59.134]:60740 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725948AbeHTOSL (ORCPT ); Mon, 20 Aug 2018 10:18:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=pt1XV7TMguPjcBhIviy74GSY8GGerSZJ83xEDpix5Ak=; b=ZW1fmKnL+qDl+M7GntOAYn1IV oCCVc3cOOO02rcPi9S6dvGHrR9h9IudZt3pXs9D52tYWks/e0eR3dZXJ3ZSoKWVar4u/KpPZyqDmR a+KigeSPcHUuCBj/kgZ/LRv4OByBc8b35cv8OycpjnLPEVeeV/wzPsgE1b2+eF9pMFHejsbF0ryRN HMjQamBfbHWtNLO8w7PhB55qSCDXGRfoIb9BJh9WtvmnES6os2uYaRvDsN0OyH3xdGZ9YiCLYIxNM uVUyuU+GozklOVWUduYSJY48RcXJ2Z5g9sfnoqRghHxvbIVoRxaOSQR1NmK63sIxgDUWOauy07SVg 4EQHZf2dA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1frhxY-0003fY-Gl; Mon, 20 Aug 2018 11:02:57 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0DD6520267B13; Mon, 20 Aug 2018 13:02:54 +0200 (CEST) Date: Mon, 20 Aug 2018 13:02:54 +0200 From: Peter Zijlstra To: "Rafael J. Wysocki" Cc: Linux PM , LKML , Leo Yan , Frederic Weisbecker Subject: Re: [PATCH v5] cpuidle: menu: Handle stopped tick more aggressively Message-ID: <20180820110254.GX2494@hirez.programming.kicks-ass.net> References: <1951009.1jlQfyrxio@aspire.rjw.lan> <1754612.IcCR94pSYR@aspire.rjw.lan> <1582055.9b67urWYFa@aspire.rjw.lan> <1572343.jWaXB8XNF1@aspire.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1572343.jWaXB8XNF1@aspire.rjw.lan> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 14, 2018 at 12:34:40PM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Commit 87c9fe6ee495 (cpuidle: menu: Avoid selecting shallow states > with stopped tick) missed the case when the target residencies of > deep idle states of CPUs are above the tick boundary which may cause > the CPU to get stuck in a shallow idle state for a long time. > > Say there are two CPU idle states available: one shallow, with the > target residency much below the tick boundary and one deep, with > the target residency significantly above the tick boundary. In > that case, if the tick has been stopped already and the expected > next timer event is relatively far in the future, the governor will > assume the idle duration to be equal to TICK_USEC and it will select > the idle state for the CPU accordingly. However, that will cause the > shallow state to be selected even though it would have been more > energy-efficient to select the deep one. > > To address this issue, modify the governor to always use the time > till the closest timer event instead of the predicted idle duration > if the latter is less than the tick period length and the tick has > been stopped already. Also make it extend the search for a matching > idle state if the tick is stopped to avoid settling on a shallow > state if deep states with target residencies above the tick period > length are available. > > In addition, make it always indicate that the tick should be stopped > if it has been stopped already for consistency. > > Fixes: 87c9fe6ee495 (cpuidle: menu: Avoid selecting shallow states with stopped tick) > Reported-by: Leo Yan > Signed-off-by: Rafael J. Wysocki Seems OK, Acked-by: Peter Zijlstra (Intel)