From patchwork Tue Oct 2 21:47:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 10624095 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2DD6A112B for ; Tue, 2 Oct 2018 21:51:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16CE620CCF for ; Tue, 2 Oct 2018 21:51:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 089F82846D; Tue, 2 Oct 2018 21:51:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3ADE620CCF for ; Tue, 2 Oct 2018 21:51:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727471AbeJCEgj (ORCPT ); Wed, 3 Oct 2018 00:36:39 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:62429 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbeJCEgj (ORCPT ); Wed, 3 Oct 2018 00:36:39 -0400 Received: from 79.184.253.194.ipv4.supernova.orange.pl (79.184.253.194) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.148) id 337d95c3ba8ca9ae; Tue, 2 Oct 2018 23:51:10 +0200 From: "Rafael J. Wysocki" To: Linux PM Cc: Peter Zijlstra , LKML , Daniel Lezcano Subject: [PATCH 6/6] cpuidle: menu: Move the latency_req == 0 special case check Date: Tue, 02 Oct 2018 23:47:43 +0200 Message-ID: <9002841.GWJsep0FYb@aspire.rjw.lan> In-Reply-To: <3510260.hvypppS8Bs@aspire.rjw.lan> References: <3510260.hvypppS8Bs@aspire.rjw.lan> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki It is better to always update data->bucket before returning from menu_select() so as to prevent disturbing the wakeup statistics collected by the governor, so combine the latency_req == 0 special check with the more general check below. Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/governors/menu.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) Index: linux-pm/drivers/cpuidle/governors/menu.c =================================================================== --- linux-pm.orig/drivers/cpuidle/governors/menu.c +++ linux-pm/drivers/cpuidle/governors/menu.c @@ -297,19 +297,13 @@ static int menu_select(struct cpuidle_dr data->needs_update = 0; } - /* Special case when user has set very strict latency requirement */ - if (unlikely(latency_req == 0)) { - *stop_tick = false; - return 0; - } - /* determine the expected residency time, round up */ data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length(&delta_next)); get_iowait_load(&nr_iowaiters, &cpu_load); data->bucket = which_bucket(data->next_timer_us, nr_iowaiters); - if (unlikely(drv->state_count <= 1) || + if (unlikely(drv->state_count <= 1 || latency_req == 0) || ((data->next_timer_us < drv->states[1].target_residency || latency_req < drv->states[1].exit_latency) && !drv->states[0].disabled && !dev->states_usage[0].disable)) {