Received: by 10.192.165.148 with SMTP id m20csp4756201imm; Tue, 8 May 2018 13:55:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqbpdZd3PeWBrKRNjjVBrZt+wXCFX5BADyLzSEcdmyq5iYuPJCCP8gj014V2Cg0vRpNQgiQ X-Received: by 2002:a17:902:7b97:: with SMTP id w23-v6mr35929929pll.116.1525812901374; Tue, 08 May 2018 13:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525812901; cv=none; d=google.com; s=arc-20160816; b=qIKjlgs5qCgv5N/iVVo7ddgsK7d7kwKpnwIz+XZeTKAzP+vkt0XHhoykIyW2EO3VRH w1b6jQFL6ZkiwbvO7J34N92xARxxhltHOKGZnvCPqJNIBqGIXOEmw0vWdJEmXjL0hw2a gp5jtO7ewu6BkgZ7PGv1a3zks82pkBpANOZmKN6EZsVXMXnotrszgXXZtrhRBaTzO3Hr 15JVhm9iEWcklB08geRo3XD4cr1/fcH3LZwYwmrf1vMj+qovKrc4PU7bL/R37k4JMRZD Ghx2JlErp4M6Z0B+q+H7+rAUnlC4PIi56B+Z4EYT0lXtjPOyL+GHyaOYAJwEWc3cQDFv zTcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=rhFYIfW5Rtjauh7W+dKpZN3VzqIeCmk6bEg/TmcJgw0=; b=qfn280UszLJbU2zA1K28rc2Irjj2gOpsA8QPiovThtd5BTq+n1EcdzaRvKSZga1cCO TsHUwLRcKJPLKUJgnbWB/LeYGRdiTeg7ydr6g5ADGuKgHvpyMGHMLBqE5bJf6wWojhCM mV6nOUh/Ln1JPxubIIPsa9hhpc3q5apF+aNJdFmmIbMFWt6UHLSrrcsPyqvy/x/W3uV2 FzCOyKQ1kK0eqjuFYv2in7jpbFwLa/+SLr1fTYG8FEPCg5pnsplbRoypC1/p1Ki3iGhZ hxVR5OwJDpL/TfQxSVUiwJdfKyE/tuvUIcSFvC1GVHriaEzss/mIQBZAu1nzZfxBe2pJ AGNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JtC7wWoz; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j3-v6si24542103pld.300.2018.05.08.13.54.46; Tue, 08 May 2018 13:55:01 -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=@gmail.com header.s=20161025 header.b=JtC7wWoz; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932611AbeEHUyf (ORCPT + 99 others); Tue, 8 May 2018 16:54:35 -0400 Received: from mail-ot0-f181.google.com ([74.125.82.181]:40497 "EHLO mail-ot0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932418AbeEHUyd (ORCPT ); Tue, 8 May 2018 16:54:33 -0400 Received: by mail-ot0-f181.google.com with SMTP id n1-v6so37717677otf.7; Tue, 08 May 2018 13:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=rhFYIfW5Rtjauh7W+dKpZN3VzqIeCmk6bEg/TmcJgw0=; b=JtC7wWozd3R/3Ks1YrSyhEdU8I7Uy3/mg1hb8YBWPtyf+MDWCr8xSUmZX1EkiXO4Jf hPbFwStKrhs7JPeOnU52GS8CWw2rfd1GelyOJ0zl992EzFXgNbU3X+gyMUjeOQX7jpw8 sT9vDElR+1e92Dw8dZQXtoCAWckWetzRXq2aemiYzfxM8Gw7TxAHnY/gqZBrxnI40mvq ZNqIO7n1sujnNAdeC0gsKzZHq0T0dvjLTowJeSGAlDpDTK+X9j8EVGNWatGxpbpZLEAd AwQmVFrwuhp/YJF1vS5Zr1sob89hQ6otRO6OkBBBT7MwpOqBg9Wn1IPzP+IIOsp2r8ps nPHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=rhFYIfW5Rtjauh7W+dKpZN3VzqIeCmk6bEg/TmcJgw0=; b=TGZc8RC0MGMK9w7bwgRCnQYjTIMkJsIyUJyoaGRIyCRK9UtalFonxUZWXlqQMUN1Ew GAkKNv1NuHBpFVAo2CK42dgwk0gJZcRqV+VRmlfnlAIgG3XcZ1uOh9hjmpB1PVBfBVKF cZ9dbaVDG9kiQb/i5hkKECHjgolN30wgCznsqgqiOAqdmtCOiLqnXvZraVGamXj49gxX P5nwFHIPaoEYs3qUvjLizbjmln8KBuaANGrIuf8RBb3X9zCWRt5u5h6ERG9SM7I26KA0 6KYHsPv+7dkYk0i0skxdycjBfDWDSmaGt/frEmjH49G6KmW3hN1uxjjl2V01XZB2qiJB hqeA== X-Gm-Message-State: ALKqPwdFz/CNm0RjE4LiAeJ0DKTJVkvMdN0GIIysykt+S7vAy5ylbBqj X5j7AToukMcl6rGzOXUf1htuKN4gBqZ1u+1Y8as= X-Received: by 2002:a9d:5990:: with SMTP id u16-v6mr3860836oth.370.1525812872653; Tue, 08 May 2018 13:54:32 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:1468:0:0:0:0:0 with HTTP; Tue, 8 May 2018 13:54:32 -0700 (PDT) In-Reply-To: <872c3f8690d9362820639d91a807e535f10a9a36.1525761635.git.viresh.kumar@linaro.org> References: <872c3f8690d9362820639d91a807e535f10a9a36.1525761635.git.viresh.kumar@linaro.org> From: "Rafael J. Wysocki" Date: Tue, 8 May 2018 22:54:32 +0200 X-Google-Sender-Auth: jMnB-cC4UPhKOrODRdjq1ZTrBOk Message-ID: Subject: Re: [PATCH] sched/schedutil: Don't set next_freq to UINT_MAX To: Viresh Kumar 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. Thanks, Rafael