Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp333553pxx; Thu, 29 Oct 2020 03:56:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+1vHEZhdN/AnvrGlsFVu+u+b6nOnpyHuMQIz9qPgNO5tdO8/HnVqPwnVn5doDdmHNtqF8 X-Received: by 2002:a17:906:4a8d:: with SMTP id x13mr3522888eju.47.1603968982293; Thu, 29 Oct 2020 03:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603968982; cv=none; d=google.com; s=arc-20160816; b=N+mGajWua5txQHCeKcKWC1F+PaL+FG6VbFZy0SarArNC8SjmjO3P6Lb/sYS546s9/o HRLUrQiZG/yFqrkFFnpgijjfQACQ1DbdbSKGRW3pyYkOT3AMbk/KAwTZn57X/eNMxeoR JEntvLuEcz05LC7jKXw3mO/9PaZIA8gvq/2BPOll7Rpid5l3eZcm56uV3P4Ng3mcx1tp cM2eCHGXEhgzN+xfA4da0WwRU/NSgPKMXKxr1uf9TORUXOs5KykaqghVvalcxL6GYbzR zq204N50avqcx6ytdjRvrC3Og7zH/XVQCvwSyHhL5Emlieq0fEHumQqEGvsjEmgsBxuY Qlnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=/IA93lh4Lo9Ev83453PFjMJYOWrNuSohoD4R/Qf7h+g=; b=ULq/VSiRXOBQqJW995iLCTwA8k2xFRm7Sgbs9UZ0/Wfj8GJ5D1Rc+a10acKz6gHPS0 ooAuC4PovmHNUzOiNBZVY3XAKt+6Pff7D8KOZ5N6wEiLS4KORecRTsoUXB9OlsAYV4XU fGXWEmT05WDdzPXVSo8MWqQLiZ43zwbjTD+ylL0oHlZ2G3N0CzmCYR2VEMtlK41FzcpW mjfYAK59E5yXKcd9sb2vUOsw+7S3zM3+jyDkrXKeqpNDOW+qhPbBQo/M2IxbPjM7p+Uh 1bB1ZvoAy90LbcQOnLjodRCWIbQPrvOcda6Chp557qvK/5CIZ49ruQ+7KqPrvqDXRlJi h4dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qpZ40ZBN; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z61si1706141ede.133.2020.10.29.03.55.59; Thu, 29 Oct 2020 03:56:22 -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; dkim=pass header.i=@linaro.org header.s=google header.b=qpZ40ZBN; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726310AbgJ2Kyp (ORCPT + 99 others); Thu, 29 Oct 2020 06:54:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726078AbgJ2Kyp (ORCPT ); Thu, 29 Oct 2020 06:54:45 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69008C0613D2 for ; Thu, 29 Oct 2020 03:54:45 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id i7so91215pgh.6 for ; Thu, 29 Oct 2020 03:54:45 -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=/IA93lh4Lo9Ev83453PFjMJYOWrNuSohoD4R/Qf7h+g=; b=qpZ40ZBNm2WL8PgWyRonOOxc12GbaFU3Ow5DXPA8JGmpuQWACGPoRYA3r/IPm8ZUZ6 +Nt9ajxu6hljelx41t/eZ6wROT62k8OknOKEJEgCWv95rG+pwqdQsHAM5Gu0xWsDrLXK UxnkHucGi8eeOC6JpN7CtSju69TtFoNgfAT2KxobKWaux2cuK/awQle/XUvNpuPrth3p QwGrua3WEPKf9txCJm3+b/O3vPhMShWFSJyYSLX+quyEAgqxSE5VUy3GcoFnFyv+QUrs Ld50D4VtProBuNkOChZOZ5rxXQBNsErWQHyk0SBi9Y8PR3vNAh4mcGXZaTOX9MrVHR2L 305A== 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=/IA93lh4Lo9Ev83453PFjMJYOWrNuSohoD4R/Qf7h+g=; b=dKwOKnq2DYjNtDRAfe2WLXX+vBt4EKdS9AE9gFTUp1wxQ5ekgjS5GtUkkijrZhL66e 1W/s001v5W43zB2MikWs9t1GLgqJ5t+eAaA502j6v+FBQZgkadF1bNk/kpU3cSg4D1Ip gVciepxocJK2Y/aEkkuCH5uT1ssFBw0Njf0vKGyIfZZFmdQqyLQInFt9orsrRR2KUnEL XqDHiPQVxVHxLrdM5RUKjUzx47MO1IWn+UtbmMxsWWkomVCssc+ZYBVL0a1tgsCpwLl9 UadISCZncWH5Q6ANlo/JrNFGVEUJumcmGg5LdJvVZtnwtaPuNX8ZsWt3bmysRo6IC5aQ W2Nw== X-Gm-Message-State: AOAM530u+L+TWDEFfiOfKYHsiP/sIXKIFeiLvTU5LfiX2pb0YV4pZk/8 T8A/Pu8y4rl2CudpUFaiIfqaHQ== X-Received: by 2002:a65:5c02:: with SMTP id u2mr3507681pgr.173.1603968884849; Thu, 29 Oct 2020 03:54:44 -0700 (PDT) Received: from localhost ([122.181.54.133]) by smtp.gmail.com with ESMTPSA id b4sm2566726pfi.208.2020.10.29.03.54.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Oct 2020 03:54:42 -0700 (PDT) Date: Thu, 29 Oct 2020 16:24:40 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Linux PM , LKML , Srinivas Pandruvada , Zhang Rui Subject: Re: [PATCH v2.1 4/4] cpufreq: schedutil: Always call driver if need_freq_update is set Message-ID: <20201029105440.gcaizotprhloxiih@vireshk-i7> References: <2183878.gTFULuzKx9@kreacher> <1905098.zDJocX6404@kreacher> <12275472.W5IoEtXICo@kreacher> <20201028035702.75f6rnbkvfaic4si@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29-10-20, 11:42, Rafael J. Wysocki wrote: > 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. Right, my mistake. I was just suggesting that we may not need to touch need_freq_update at all but just check the flag. -- viresh