Received: by 10.213.65.68 with SMTP id h4csp1899542imn; Thu, 5 Apr 2018 05:49:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/AxDtOKdvELPdq+iEBc3j3zUnuNeIQGYAJ1Qzdn1W0a5HqbPo0V0y33+kInbzBYQHuOZ9c X-Received: by 10.99.116.8 with SMTP id p8mr5982408pgc.327.1522932572128; Thu, 05 Apr 2018 05:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522932572; cv=none; d=google.com; s=arc-20160816; b=hj/E7oBDQ01KOM7RZBRmOCn6HpRyv5ciQ9waGsl8M6+clLpU4WgmiZJBw5Wja/2JcG kP/D2S7CKkuO23vl+076kZTFbXOrFb+b//FxX+wyPh7t9alP3ZaiXHEiGmMVHRE9ZZJW Z/l2efHpRHIXLAfFIM7uaSXA+Qmlrz0n9JRs7gAxfQGz5ym0kdag3P73VUOlcFde3yx7 ChRTW5/7Vem9gaSuLOP1j0ERy6HhZAad3mK+FKMeOlMkzZEozO/DBHo15aEN8cIzj6cK leH50PKJxSXzmnBWHNnDQ3V9L8uwMVffAApo2xAz80/N+EzKJKfj8/t0xbJL6QdnXf5m 2+NQ== 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=QnQvFMdjNJ15rA4Swrwf+03cx3izhbHWZpTrFGOixAk=; b=eFN0lBysrFVE7TmlEoSiK3BDqtaJ4QMvHPrWKpxn2yLxq5TeQ73FBPvUg/F7Qx0DDN EwSbGZ9CRnghwqS892dtzOYQZ45hIo3uMlU6PBIabXxzPlLLWL2Abo5ZbeMkTM8AdS1G /XyOuf+5LWCpQYYXQ+r0h/IS7FSNsMM261RxtL5jXZkKmUPmIx9FscLCMoteaa6tYlzz KMv1MAqD48cO/BNaPOfvK2RP6WRb1lbJtXYMfWUGgRKxZu/x6OTEk7Wl8JTMKQWNLsra XQKSMvP5XLKzamBkt5Jo5csb9OwUgq1D/9mEsCUWBN5GFOwtFFddkPepD3MhfRUNuvOb 2Hiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=EaL1B4Zi; 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 l184si5336661pga.525.2018.04.05.05.49.17; Thu, 05 Apr 2018 05:49:32 -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=EaL1B4Zi; 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 S1751332AbeDEMsO (ORCPT + 99 others); Thu, 5 Apr 2018 08:48:14 -0400 Received: from merlin.infradead.org ([205.233.59.134]:56866 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751097AbeDEMsM (ORCPT ); Thu, 5 Apr 2018 08:48:12 -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=QnQvFMdjNJ15rA4Swrwf+03cx3izhbHWZpTrFGOixAk=; b=EaL1B4Ziz4i55bNJx6YQM/RRE qfH08dE69nTXaALGkNo2zAKuC9BthxLzmAxJwEe0hQ/lW+1VqEELHU3/ovgbSn0WMhvproGLQ0Y0V N/aIclz40wUdU5zt56aASUxY05RbVw5Nga3r7iFus4vzHE+6CK+Sz6PUz6gwK8i7fkuDnC67VtwTi b93I17Sj3mrwfxyCt44QOCTAaKF0wNCb1f2rB86c9zq9vLnzbyOHwDoPlOtZoEgnA7qj3SQtRvcgT uvzpGM1XqFKPseip4WwBvgeEVdJVx9/pZxa7A6jZuNwN5PZ6k0QZoXMn3nQaE118x3cAeULWr+I2A A5pSbLe0A==; 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 1f44J4-0001A3-T3; Thu, 05 Apr 2018 12:47:59 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9F1642029B0F8; Thu, 5 Apr 2018 14:47:57 +0200 (CEST) Date: Thu, 5 Apr 2018 14:47:57 +0200 From: Peter Zijlstra To: "Rafael J. Wysocki" Cc: Linux PM , Frederic Weisbecker , Thomas Gleixner , Paul McKenney , Thomas Ilsche , Doug Smythies , Rik van Riel , Aubrey Li , Mike Galbraith , LKML , Len Brown Subject: Re: [PATCH v9 10/10] cpuidle: menu: Avoid selecting shallow states with stopped tick Message-ID: <20180405124757.GQ4082@hirez.programming.kicks-ass.net> References: <1736751.LdhZHb50jq@aspire.rjw.lan> <6542020.eHGLEK9V0J@aspire.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6542020.eHGLEK9V0J@aspire.rjw.lan> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 04, 2018 at 10:50:36AM +0200, Rafael J. Wysocki wrote: > + if (tick_nohz_tick_stopped()) { > + /* > + * If the tick is already stopped, the cost of possible short > + * idle duration misprediction is much higher, because the CPU > + * may be stuck in a shallow idle state for a long time as a > + * result of it. In that case say we might mispredict and try > + * to force the CPU into a state for which we would have stopped > + * the tick, unless the tick timer is going to expire really > + * soon anyway. Wait what; the tick was stopped, therefore it _cannot_ expire soon. *confused* Did you mean s/tick/a/ ? > + */ > + if (data->predicted_us < TICK_USEC) > + data->predicted_us = min_t(unsigned int, TICK_USEC, > + ktime_to_us(delta_next)); > + } else { > + /* > + * Use the performance multiplier and the user-configurable > + * latency_req to determine the maximum exit latency. > + */ > + interactivity_req = data->predicted_us / performance_multiplier(nr_iowaiters, cpu_load); > + if (latency_req > interactivity_req) > + latency_req = interactivity_req; > + } > > expected_interval = data->predicted_us; > /* >