Received: by 10.192.165.148 with SMTP id m20csp5245784imm; Wed, 9 May 2018 01:43:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrvx4rQs62EEMkYYBWT2XVcJAoXZ+clVNH9MIT4b7uEm2LZERKfUKbZmr3uetOzDN55aHfC X-Received: by 2002:a17:902:3e5:: with SMTP id d92-v6mr46293791pld.104.1525855415153; Wed, 09 May 2018 01:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525855415; cv=none; d=google.com; s=arc-20160816; b=pra1O4IVrpensk0Zy5ZuX39OhQf473qTS2q4i1d14EzIJIxk43DcRPg0/EEh2H1nO7 7GDvG3jwAkoR7uXqGrdV2Q9E6GyP73LaByBX/7occoAhciBYeLP0DiLARaWdOSGYKsjG hgySEbaQ+432qx0Zx1Pwp3wBsGgcVASg+iiLeD8+vYSwZCdNqLeUd+kmQiTxxE/eOROj PjUn2EEgtrpL1/LrTcrpqaH6q9hpfZiz5LwqWO2K2Cl9zy5zTtpINqdeqzbT4MDmMgNr t5Ein0qWSJLfBnd457H+KBQELkZV+LpyCC3wvgBw0hDwhbH8xHPI55tO8IYq4ML33NVg KZ1Q== 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=E4a3p1X31MfLLrSZ2x4omopjhbW05TFQB6HMqjK/pCs=; b=Ms09AqhykEwHmzin1PC4vaSRWYYHE8b8gGXH0T9GczYrWXzWk9J4CGgeTPtTueEdzW L5G9rkzBY3YxrOd2EFnbvq7N8YYqxLwoElcf0lzzaV8B80ujrhJ8HHHjcG53hRsDpN/g lRPV53YINcHA4z4vvQGkUEI+nzAJZ0ZxzlXvCzf6FZ3wUKUZOguP3zu72AFfc4q7i5I3 ehQRG4UM7yKJxXWCHBAbGqEUyd0jDTHlt+lVBmsr5AUU7/mIu1TQTcWGQr0Agbb4UAeR KmpFu3pJVrbrVs2yafk49UyzxoMoD+0ZpQz8UZ6tDOOawBUFqllTSvzziCMigSKlE8WE 20nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=InY10SqE; 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; 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 r144si20198090pfr.286.2018.05.09.01.43.20; Wed, 09 May 2018 01:43:35 -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=pass header.i=@linaro.org header.s=google header.b=InY10SqE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934393AbeEIIli (ORCPT + 99 others); Wed, 9 May 2018 04:41:38 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36056 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934371AbeEIIlc (ORCPT ); Wed, 9 May 2018 04:41:32 -0400 Received: by mail-pg0-f66.google.com with SMTP id z70-v6so2158287pgz.3 for ; Wed, 09 May 2018 01:41:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=E4a3p1X31MfLLrSZ2x4omopjhbW05TFQB6HMqjK/pCs=; b=InY10SqEuHCM7FucIeGDQuEz9A/Xc1RKZvQ9x983wcgSVXMRuAvpAD2eqECA7ISe0+ 5a74FdBGpcPibHF2Fs9x/CLZ9LTeMZf3UcRlXVBaBgfIHy/klY6zeefXCFe7JFmYoVLm Bsx8DFvZfc4cjX5JyuPt3KdZa+W+O2WEpm7Lc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=E4a3p1X31MfLLrSZ2x4omopjhbW05TFQB6HMqjK/pCs=; b=bRzSYG1C+QG/50tkM0snaOYTEssVaYu4xdEfWqfs2ggpSdKll3MkgLmkO92saEdLk7 BuQ78KccnCJvLXbmbtkVnls6A4lQrsPkESMr2CjIp7voRYYnqEOR08Z7MbjHWpKED8w/ B+aIpRjhKDT5umhoDLEJf1giwr1P6zXHveRo5Q7w9LzPnxEKNJXVKIh4CqnRbuhC2Sih gsk1XfnPuzMwqaKmHYZ4TCEiEyoHewXJe4mVx3MrBMhYodnfST5Bw+lpc3QfzOd4Vrvc m5rqT3BnXH7NH8oJ3/qh86B7AytuwB7toDls9YXUjeqYHZHswwQtXdz9jZZbBjHrRni1 bY0w== X-Gm-Message-State: ALQs6tDO3dqQW5bMz63N/CH+RhmWp7q82r0Ad0sCgYQHTglNEVS9iEyF LEolJuT5ST8/HywWxXTfZNiU+g== X-Received: by 2002:a65:5a81:: with SMTP id c1-v6mr35486493pgt.20.1525855291180; Wed, 09 May 2018 01:41:31 -0700 (PDT) Received: from localhost ([122.167.163.112]) by smtp.gmail.com with ESMTPSA id j1sm58803248pfc.159.2018.05.09.01.41.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 01:41:30 -0700 (PDT) Date: Wed, 9 May 2018 14:11:28 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: Rafael Wysocki , Ingo Molnar , Peter Zijlstra , Linux PM , Vincent Guittot , Claudio Scordino , Patrick Bellasi , Juri Lelli , Joel Fernandes , "4 . 12+" , Linux Kernel Mailing List Subject: Re: [PATCH] sched/schedutil: Don't set next_freq to UINT_MAX Message-ID: <20180509084128.s3nu57njyep4tw2w@vireshk-i7> References: <872c3f8690d9362820639d91a807e535f10a9a36.1525761635.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08-05-18, 22:54, Rafael J. Wysocki wrote: > On Tue, May 8, 2018 at 8:42 AM, Viresh Kumar wrote: > > The schedutil driver sets sg_policy->next_freq to UINT_MAX on certain > > occasions: > > - In sugov_start(), when the schedutil governor is started for a group > > of CPUs. > > - And whenever we need to force a freq update before rate-limit > > duration, which happens when: > > - there is an update in cpufreq policy limits. > > - Or when the utilization of DL scheduling class increases. > > > > In return, get_next_freq() doesn't return a cached next_freq value but > > instead recalculates the next frequency. This has some side effects > > though and may significantly delay a required increase in frequency. > > > > In sugov_update_single() we try to avoid decreasing frequency if the CPU > > has not been idle recently. Consider this scenario, the available range > > of frequencies for a CPU are from 800 MHz to 2.5 GHz and current > > frequency is 800 MHz. From one of the call paths > > sg_policy->need_freq_update is set to true and hence > > sg_policy->next_freq is set to UINT_MAX. Now if the CPU had been busy, > > next_f will always be less than UINT_MAX, whatever the value of next_f > > is. And so even when we wanted to increase the frequency, we will > > overwrite next_f with UINT_MAX and will not change the frequency > > eventually. This will continue until the time CPU stays busy. This isn't > > cross checked with any specific test cases, but rather based on general > > code review. > > > > Fix that by not resetting the sg_policy->need_freq_update flag from > > sugov_should_update_freq() but get_next_freq() and we wouldn't need to > > overwrite sg_policy->next_freq anymore. > > > > Cc: 4.12+ # 4.12+ > > Fixes: b7eaf1aab9f8 ("cpufreq: schedutil: Avoid reducing frequency of busy CPUs prematurely") > > The rest of the chantelog is totally disconnected from this commit. I added the "Fixes" tag because this is exactly the commit after which this problem started, isn't it? > So the problem is that sugov_update_single() doesn't check the special > UNIT_MAX value before assigning sg_policy->next_freq to next_f. Fair > enough. > > I don't see why the patch is the right fix for that, however. I thought not overwriting next_freq makes things much simpler and easy to review. What else do you have in mind to solve this problem ? -- viresh