Received: by 10.192.165.148 with SMTP id m20csp5302059imm; Wed, 9 May 2018 02:47:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqjWUSLZrNd7AoqI+vJ73JMoaA7PlRr/z7BJMP+eIRtGWHyRZm0C65Q1qYHZo24Vg79EQ7v X-Received: by 2002:a17:902:1682:: with SMTP id h2-v6mr45030964plh.127.1525859270256; Wed, 09 May 2018 02:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525859270; cv=none; d=google.com; s=arc-20160816; b=Zux8g6JxDiUacIuzLFcP/WdcqjE4fvJpL48efI1mat60k/vIO7DguJqnZU3+3v3B0y xMkn3VP8WF+d85TMsOzZzwyVvtpIfiO+uiSIjKn8hElS3XXRBdIXrHDm/0hiOkbX/3c9 pG3yjDrTVEuSJiD+Lj2ecEcBh+YD+Gjxs+cp+x7rg4IjlnfJedw/sTfNMk7FuU2AVS4p nmoaY5EAbCzNznZUgP7xAm1uTvTuY7JE+NVYquOokWa1rHidgHDRhHWuvbKeN5T+5AKF rrycG9a4MhSqRdSNg37+Qy1RYgrvvX3nuH1aadDYSqufQ1iGW1VA2mNwqJrt79tQCvXI MiPw== 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=IqeMnozJlCr/hTHQFzerI9/IdG9y0NW76K3bWfwZQlo=; b=eMZLP9NbvqOI3n2QWZwgdhT/I52YsURIQOUWJIuID35HIclSdwZ1cN9PIJUVvPcZrA eT1Oj3zzaM8S1Lal4d1y2oq5vS7Xc8/8iphu73t5RSMYFcPGGWFZbsiFcWaN4ombL7tA hfGxP5o9GyG/Wn1/fgWvu3ONOLOgxfH0xnxATgXUjEwQ7I5ikxa2h3fveXbngBZXIlMH yZXC4BF8MBDvlIqDD6N6SkLBdWp3U1vW4M4nkvqGl4ORhf4U2BDa9E3KMTmcmirgUDyT 5OkT1/sTpXxWYlK+O6Td2o0E2C74iykjXgsfgl22sC5TrRvo7LEzkhjwhZbmpmjWF89A X4gg== 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 g12si14034129pfm.258.2018.05.09.02.47.35; Wed, 09 May 2018 02:47:50 -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 S934285AbeEIJpY (ORCPT + 99 others); Wed, 9 May 2018 05:45:24 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:52583 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933783AbeEIJpW (ORCPT ); Wed, 9 May 2018 05:45:22 -0400 Received: from 79.184.255.167.ipv4.supernova.orange.pl (79.184.255.167) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83) id 3ffe1b41cdeba4a2; Wed, 9 May 2018 11:45:20 +0200 From: "Rafael J. Wysocki" To: linux-pm@vger.kernel.org Cc: Viresh Kumar , Ingo Molnar , Peter Zijlstra , Vincent Guittot , claudio@evidence.eu.com, patrick.bellasi@arm.com, juri.lelli@redhat.com, joelaf@google.com, linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: schedutil: Avoid using invalid next_freq Date: Wed, 09 May 2018 11:44:56 +0200 Message-ID: <2276196.ev9rMjHTR0@aspire.rjw.lan> In-Reply-To: <872c3f8690d9362820639d91a807e535f10a9a36.1525761635.git.viresh.kumar@linaro.org> References: <872c3f8690d9362820639d91a807e535f10a9a36.1525761635.git.viresh.kumar@linaro.org> 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 From: Rafael J. Wysocki If the next_freq field of struct sugov_policy is set to UINT_MAX, it shouldn't be used for updating the CPU frequency (this is a special "invalid" value), but after commit b7eaf1aab9f8 (cpufreq: schedutil: Avoid reducing frequency of busy CPUs prematurely) it may be passed as the new frequency to sugov_update_commit() in sugov_update_single(). Fix that by adding an extra check for the special UINT_MAX value of next_freq to sugov_update_single(). Fixes: b7eaf1aab9f8 (cpufreq: schedutil: Avoid reducing frequency of busy CPUs prematurely) Reported-by: Viresh Kumar Cc: 4.12+ # 4.12+ Signed-off-by: Rafael J. Wysocki --- kernel/sched/cpufreq_schedutil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: linux-pm/kernel/sched/cpufreq_schedutil.c =================================================================== --- linux-pm.orig/kernel/sched/cpufreq_schedutil.c +++ linux-pm/kernel/sched/cpufreq_schedutil.c @@ -305,7 +305,8 @@ static void sugov_update_single(struct u * Do not reduce the frequency if the CPU has not been idle * recently, as the reduction is likely to be premature then. */ - if (busy && next_f < sg_policy->next_freq) { + if (busy && next_f < sg_policy->next_freq && + sg_policy->next_freq != UINT_MAX) { next_f = sg_policy->next_freq; /* Reset cached freq as next_freq has changed */