From patchwork Mon Jul 22 06:51:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169339 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp7136456ilk; Sun, 21 Jul 2019 23:52:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+UKUUvoy4BxnLJ2e17y+n2nE5sGedknoI8DCF8BM8RjQA59iebe+59waL+A45sK8ybA0s X-Received: by 2002:a17:902:d70a:: with SMTP id w10mr69883086ply.251.1563778322607; Sun, 21 Jul 2019 23:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563778322; cv=none; d=google.com; s=arc-20160816; b=VT2hXcwRIgSyqO9b8wSWsmtBg5RiUksR/+nrXNXWn1cguR5YmZJHqSZl0Wnl3rWqB9 T2Xots/43xWWwhx4BGNzvsLbRaR1czoeGg8ZNy/PbfmU0lueo51C1mg/rFyyrv+iw9y1 Ig+vJC6SY1GwR0RkhdGOtCgo/E26/Hv7Hv3Rql3Turjid53OjPijYPvPDpEiwQbu74X+ RRrW/1SJ0IIkAwHL2Y++tmU3jVs9Yeo+0lWGDOP4sCHBOxoq6e6uZif+0MU145ff8+Ao HZd2F01Wd4UXZIH+ycATDAza9MhBUmsDEt7oyatAIt3D3D6aoZSXnRq+s1/9oZrFHfsY doMg== 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 :dkim-signature; bh=KviHflI7215zrUthnS1gXggMXKtV9Y/Ymw3VDs2vemM=; b=F4ibYfDkcsEQdSLax4NZfdun6J1nQwZoSmo6RzQowwAwz5fB0ilhkZKVjjNno7UL4R u/x/2mpqsMz8Rs5Cew6/vc0iDlS18uMyQvzzOMyUGGjCX5OEj+qd/an9CuRjDMA+BFZD yAsV0rlv+I0Z15vmzbK+0qLo5WmPKW+jV4UhkbjO7aEpQ8of9TFs0aMzUKoR/g0AmHYk /900XT2WMnkUwZUYmIMMKXKk8fyD8ST2k1KmITDYd/7qFibvzGakdaMvkbpqlfX1Nl2O iXK6bIvb2Tbu9EBxICQQGiJkOb4X98H3a/uLg2Hg1G4VZHauc1x37RPIGLjNDRSUAIgL pVag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xiI+A7Lz; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si7852362pgi.587.2019.07.21.23.52.02; Sun, 21 Jul 2019 23:52:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xiI+A7Lz; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726944AbfGVGwB (ORCPT + 14 others); Mon, 22 Jul 2019 02:52:01 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:35419 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726236AbfGVGwB (ORCPT ); Mon, 22 Jul 2019 02:52:01 -0400 Received: by mail-pl1-f193.google.com with SMTP id w24so18750704plp.2 for ; Sun, 21 Jul 2019 23:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KviHflI7215zrUthnS1gXggMXKtV9Y/Ymw3VDs2vemM=; b=xiI+A7LzjIZ4RN3YaVr53KXlrp2CjtY3C1XCvK2GvNMkkQaKB9HpK5kD9nEbHP0uIs mQBzYgXLgvecOewN+yajjz+T0mSbKjLF7Rls8iljtb2HrWSoqn6TCQwPK6r3jMQNmLVO J1W43UoCtyWi+Bbakiasf8/S53w3OqG9gSxOPByXpcCrjvFGCMgk9m6mXJrUoAOpxBgv bLf5M540QjWlTbL/YcQycqGBDcaNLH6/65xZWVyTvRGbcGxHA8+kUBJoFtZPfiqMzdIO 795kSv2AeYwn0M6bKRtKPAA6HYNKae6WvxSxVTqnM6RrH9gzqld2gAgo7y9XqzL+HUw7 e0NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KviHflI7215zrUthnS1gXggMXKtV9Y/Ymw3VDs2vemM=; b=NWLjuNeoO9z45DePLPny5KTzR/c6Eq1OAohAFzQxvapJavaFb+vHqRaXmp3Ul/C3Jo cZDjxje0fnDmfN89mHqq5nHhhKq7ADt9XjorFV9IMZiXL3nLGrkBrRw9JzDYOSDdruzl xmFdoiDXm/mQMqpwDPlrRWya+MTYpHHX4zPh2VgdtZKhSZtljkCCzQJ1ZJnRACWNd7zE MDJyVrGwN18zwaA+cPwLXtjMxD4m3yFiZwCSMz11JcMjgohJjORH1NSrPhDDBfKemsDg jtK8/UstHzLyXTHIcH7sc+Y4gt9MNf3UZauQXX5JG5tY+2caxXQgaCI6JQ1Ls2CBOsne 2WvA== X-Gm-Message-State: APjAAAVc7gtsMaeq2Gb7wRjRIiqMBHnsPzOEssaKDkFYivH50PJ7E8SE rVV/G4HGqdwJDxL3ztC0y7tQ4g== X-Received: by 2002:a17:902:7448:: with SMTP id e8mr73804121plt.85.1563778320961; Sun, 21 Jul 2019 23:52:00 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id b6sm34300949pgq.26.2019.07.21.23.52.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Jul 2019 23:52:00 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Ingo Molnar , Peter Zijlstra Cc: linux-pm@vger.kernel.org, Vincent Guittot , joel@joelfernandes.org, dsmythies@telus.net, "v4 . 18+" , Doug Smythies , linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: schedutil: Don't skip freq update when limits change Date: Mon, 22 Jul 2019 12:21:57 +0530 Message-Id: <8091ef83f264feb2feaa827fbeefe08348bcd05d.1563778071.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: <1563431200-3042-1-git-send-email-dsmythies@telus.net> References: <1563431200-3042-1-git-send-email-dsmythies@telus.net> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org To avoid reducing the frequency of a CPU prematurely, we skip reducing the frequency if the CPU had been busy recently. This should not be done when the limits of the policy are changed, for example due to thermal throttling. We should always get the frequency within limits as soon as possible. Fixes: ecd288429126 ("cpufreq: schedutil: Don't set next_freq to UINT_MAX") Cc: v4.18+ # v4.18+ Reported-by: Doug Smythies Signed-off-by: Viresh Kumar --- @Doug: Please try this patch, it must fix the issue you reported. kernel/sched/cpufreq_schedutil.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 636ca6f88c8e..b53c4f02b0f1 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -447,7 +447,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, struct sugov_policy *sg_policy = sg_cpu->sg_policy; unsigned long util, max; unsigned int next_f; - bool busy; + bool busy = false; sugov_iowait_boost(sg_cpu, time, flags); sg_cpu->last_update = time; @@ -457,7 +457,9 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, if (!sugov_should_update_freq(sg_policy, time)) return; - busy = sugov_cpu_is_busy(sg_cpu); + /* Limits may have changed, don't skip frequency update */ + if (!sg_policy->need_freq_update) + busy = sugov_cpu_is_busy(sg_cpu); util = sugov_get_util(sg_cpu); max = sg_cpu->max;