Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp326911pxx; Thu, 29 Oct 2020 03:45:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwawnAHQOULyoj97R09rK4anrAEmSDTMdr0CIV1AZQYKG6oyQdo6BwmzQO8LL2lk62+Ie93 X-Received: by 2002:a05:6402:287:: with SMTP id l7mr3188612edv.212.1603968306454; Thu, 29 Oct 2020 03:45:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603968306; cv=none; d=google.com; s=arc-20160816; b=w8xDgH1HmVuQSvumsJOkzkFvh+qyR6XLffwQcs/gTrY24f9NXFUWjPFHBez8pvK1Fj fa8bBBjrlJD0Xyw/r4T15Vl87wAa/sB1HCaeRVTANlOTj1enHrkDLBgYMkTJGBmOyQcZ vOobn+J7E0r4+cPCSoHa9q49JHjTsmQEmxKHjUozi7Ov5ijyi5V+0/vIFVuaU0hil98w qZNa5wDHkFH2QN4kvvyTLfhklhlgULNs7ser4PhzDN2KimTp3CTJH6t/I03hV/weBY4F 5B7ReoqeQd/VpO3ai6V8kJMWxA2gLRQOZKtWifdi/rhHI1GWTZbhnA6i6JK54qc8Wune RoqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=iwJ38VzBMmI3Ef757/3PaRmPBncmzMloPmX0ZrpiY2k=; b=iSjrqzCCzz7832gXq2EalnoEhtkh2eMVa3Gxzpy0a7jc1n6soOTfR396MRfdHwTR/M bUn4CIn/SaoIiz/2Hflu5xa6X+aevzPt63YHPjlRPDyYv6x3Nac+MmdBu5hAIy+WYA6v iPaPDYYw9BVsd5RX/Lzwt9rhaJojBfVypVmujeZIaP/E2H6u1j7lKK8GM+cyxSONYjw3 IHClmZOb+eHjY+tPB4ZYF/tAp0t6av+yxmkUg8pjE3H5qdp1puV8kdCembhTWCB6cAow /bDMKp06oHOwVHzwPClyiMGuqm3/NfQY2S8DtnGYX+rStx5wc9feGu5c+/wHiCUEEkf6 sAEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r27si1403768ejc.681.2020.10.29.03.44.43; Thu, 29 Oct 2020 03:45:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726370AbgJ2KnO (ORCPT + 99 others); Thu, 29 Oct 2020 06:43:14 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:34962 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726134AbgJ2KnK (ORCPT ); Thu, 29 Oct 2020 06:43:10 -0400 Received: by mail-ot1-f67.google.com with SMTP id n11so1853204ota.2; Thu, 29 Oct 2020 03:43:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iwJ38VzBMmI3Ef757/3PaRmPBncmzMloPmX0ZrpiY2k=; b=Rs+xzNJoZ9XpzmVqQIxJKoPx3B2QmVc6YFlnIeJGMv0lTVedI6hr184xiY3wMZ5FfU vz5pyT9CDexPsFTKAvK0pL71rUCsTYcMt+VHQj9eSjhXV5E2G8kyAmV8ROvdQ0hM0zS5 u7tJArOEBcLpNbjIOESb1Lz/l//x+afcQ1FesvmqhPvug2IAHhUzguSAURxbaZNrJWd1 13FeozjKkwuFqwmUNKhqkw52GqIq51ANb1yUaBUmpWy2aWUIJ93ql6mPhtFDAE8SJ12T 2c2PIw5w48BAfnS+7ZFx+cjLwEO3noCDFrQ/I7eCQYqCedMMTZyzb0Y9CWM2Pvjr1ozh KZFg== X-Gm-Message-State: AOAM530Ab7noVjoWLmJtKft3a0DqbvOEZBnZig+bt8pIdklgQYB9PmTX Y4emRHb4xxfVXlOaTk3aO101RIw20qEMA8qG9J0= X-Received: by 2002:a05:6830:18cd:: with SMTP id v13mr2855310ote.206.1603968188569; Thu, 29 Oct 2020 03:43:08 -0700 (PDT) MIME-Version: 1.0 References: <2183878.gTFULuzKx9@kreacher> <1905098.zDJocX6404@kreacher> <12275472.W5IoEtXICo@kreacher> <20201028035702.75f6rnbkvfaic4si@vireshk-i7> In-Reply-To: <20201028035702.75f6rnbkvfaic4si@vireshk-i7> From: "Rafael J. Wysocki" Date: Thu, 29 Oct 2020 11:42:56 +0100 Message-ID: Subject: Re: [PATCH v2.1 4/4] cpufreq: schedutil: Always call driver if need_freq_update is set To: Viresh Kumar Cc: "Rafael J. Wysocki" , Linux PM , LKML , Srinivas Pandruvada , Zhang Rui Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 29, 2020 at 12:10 AM Viresh Kumar wrote: > > On 27-10-20, 16:35, Rafael J. Wysocki wrote: > > Index: linux-pm/kernel/sched/cpufreq_schedutil.c > > =================================================================== > > --- linux-pm.orig/kernel/sched/cpufreq_schedutil.c > > +++ linux-pm/kernel/sched/cpufreq_schedutil.c > > @@ -102,11 +102,12 @@ static bool sugov_should_update_freq(str > > static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time, > > unsigned int next_freq) > > { > > - if (sg_policy->next_freq == next_freq) > > + if (sg_policy->next_freq == next_freq && !sg_policy->need_freq_update) > > return false; > > > > sg_policy->next_freq = next_freq; > > sg_policy->last_freq_update_time = time; > > + sg_policy->need_freq_update = false; > > > > return true; > > } > > @@ -161,10 +162,12 @@ static unsigned int get_next_freq(struct > > > > freq = map_util_freq(util, freq, max); > > > > - if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update) > > + if (cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS)) > > + sg_policy->need_freq_update = true; > > + else if (freq == sg_policy->cached_raw_freq && > > + !sg_policy->need_freq_update) > > return sg_policy->next_freq; > > > > - sg_policy->need_freq_update = false; > > sg_policy->cached_raw_freq = freq; > > return cpufreq_driver_resolve_freq(policy, freq); > > } > > What about just this instead ? > > static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time, > unsigned int next_freq) > { > - if (sg_policy->next_freq == next_freq) > + if (sg_policy->next_freq == next_freq && > + !cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS)) > return false; > > sg_policy->next_freq = next_freq; > sg_policy->last_freq_update_time = time; > > return true; > } > Without any changes in get_next_freq() this is not sufficient, because get_next_freq() may skip the update too. If the intention is to always let the driver callback run when CPUFREQ_NEED_UPDATE_LIMITS is set, then both get_next_freq() and sugov_update_next_freq() need to be modified.