Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp333437rdb; Thu, 5 Oct 2023 07:20:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE64sxpkdGBjSW8tT/Md0x6Sn/dRGLoY9pFdG6nucxIzh2O/r5q26Z1Yg4nyQwfZrA7ENJD X-Received: by 2002:a17:902:db0c:b0:1c7:54ee:c560 with SMTP id m12-20020a170902db0c00b001c754eec560mr5302901plx.55.1696515613791; Thu, 05 Oct 2023 07:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696515613; cv=none; d=google.com; s=arc-20160816; b=CzTDqMWpu9os/ZED8hHuInuLaE5or1LMeBg3awecFlQRAhhaF5XyozbJ8NXHjsSdLQ YUI5D+NGXKRwifjiJE58Mv5FVRDGw+q+OMHhqVqmpHL9IInO388siZCm48aCDjHxjaeK LvliDResVNr+BN6reVbzOh9QNF3OUx7cZsQJ3Cu65Sp9wvlTp/ExGDZQ8kD9Mg9CwBGa fHYhQg5cAS3UC6H7NNIcahf4yFAoAGPTF9wgRNcC1UGzFoz9eP5FxtkogIAfvDjSwYG8 wQjjSVZhdcOpmkjsElIG3j8RmbuOjuRmP96F+qsvQWn9RQi3q2VIbnHWtrwK2C0645HO 5Raw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=+DmKqCIULKrNCF4CdnTVqFVH0GO4tyriLLf0pJhJwn8=; fh=Q93exHdEFNJYRXyT6coUSWqcWyT4DrqlUOj3QSI/HQ8=; b=hM1iKBDM1jTSy3WvtTBXlX2OVndS5s9MlZPwSw/ZxPo9LyQ7Uk97hJLc4EZp0xAbR8 3B2dCSan0HdPw7dD5a9KLHUD2rGrFzPq8nwu9FdsU1ReGjZybswbT9o0SobTCkDyJR0o gWFAkzKdLRy0JkhDwXe0Lf3SW/Ty4zf/eVynymlCWVXvkbxFmYhlBNiNJOx62lWVXLYQ S+i8ci7tW3IojFSbIWYGC4mhs5vgf7uV5zQDpWG0DcjhzYaWuSVqjSByABKepjNO4xBP 1qE/m4IgDx5vn21EMeKU3uyJaXD79LBZt147nwIRsnLrLgWhb5+OInzq87sVVNwWesbB fTag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=c8QMNDHB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d6-20020a170902654600b001b89b1bae72si1530697pln.528.2023.10.05.07.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:20:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=c8QMNDHB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B41BB8238B52; Thu, 5 Oct 2023 07:20:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233659AbjJEOTp (ORCPT + 99 others); Thu, 5 Oct 2023 10:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231175AbjJEOR0 (ORCPT ); Thu, 5 Oct 2023 10:17:26 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD7E124E8C; Thu, 5 Oct 2023 04:26:57 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-9b2cee40de8so196387866b.1; Thu, 05 Oct 2023 04:26:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696505216; x=1697110016; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=+DmKqCIULKrNCF4CdnTVqFVH0GO4tyriLLf0pJhJwn8=; b=c8QMNDHBvspat2uzGkqpylt6eI5eKmwpZdEUgeW1P3d9/qEdr4ks0i8EHcEmJoRfmc WNrIPWIqGOF9idTc0wbJkTBZG8o4H1KZni2I72O4Kl65nq/giDF5WswlwbIXrF+FyCJM HxlRav71tu76r0eTOL3WEjt1592f/9YQ+q9arHBJhysSdEqDAyKpaNni5n2MgogXyCEW TA29UVIizTaPKj/rRhGz6bL5Hod3c5f643epJRbt9UAIeRil/Ip4XEsqXsencLpjC1ey Nze+19KcibFr0K6LZx2Gx8Xp8Cl4xJt+FCTeZqBmsDfutHRGW7wLPPQ6y18NDJyIy8rm zupQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696505216; x=1697110016; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+DmKqCIULKrNCF4CdnTVqFVH0GO4tyriLLf0pJhJwn8=; b=nmInUbCianuIFNgzkoIDlKyrZnp8XwGgYm3rXJVK+WE0D4FsBv1UYgdg2k0nogxbt8 OjptI7XgINB3Nrijpa+oXcWrxN6VQNErD0wNBuwfAYpFTvSBJf77SWGF33yrK4BWteKe zDEB/UtjgEQ/JmknS+8G3brsC+qkKPlb1e5fO6+y+d4QQJmG6DKRNs8jHUZxVwNqE41Z mPg8e6mfP4yhpFfE4/kzMoREeMzOFQS6vygcNi/VQMOvJ2h0ksh1WGyRLEwBF1NiVlBf 1RDgVTNxDom1/s29mRaddJT4x0AhLBnP/kU8zytCTLifOQZ4aAyYqTbkligSvApBzAjN zXbQ== X-Gm-Message-State: AOJu0YyNAxDKFKzDU12if1U8eUpulqrBB3fS2KyVt7HmxylhpQ6p/UDP AWv3xpdpyOz3Me0noB7Gq3I= X-Received: by 2002:a17:907:7291:b0:9ad:8641:e91b with SMTP id dt17-20020a170907729100b009ad8641e91bmr1018565ejc.11.1696505216033; Thu, 05 Oct 2023 04:26:56 -0700 (PDT) Received: from gmail.com (1F2EF530.nat.pool.telekom.hu. [31.46.245.48]) by smtp.gmail.com with ESMTPSA id rn4-20020a170906d92400b0099bc038eb2bsm1025054ejb.58.2023.10.05.04.26.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 04:26:55 -0700 (PDT) Sender: Ingo Molnar Date: Thu, 5 Oct 2023 13:26:50 +0200 From: Ingo Molnar To: Xuewen Yan Cc: rafael@kernel.org, viresh.kumar@linaro.org, mingo@redhat.com, peterz@infradead.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, guohua.yan@unisoc.com, qyousef@layalina.io, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cpufreq: schedutil: next_freq need update when cpufreq_limits changed Message-ID: References: <20230719130527.8074-1-xuewen.yan@unisoc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230719130527.8074-1-xuewen.yan@unisoc.com> X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 05 Oct 2023 07:20:12 -0700 (PDT) * Xuewen Yan wrote: > When cpufreq's policy is single, there is a scenario that will > cause sg_policy's next_freq to be unable to update. > > When the cpu's util is always max, the cpufreq will be max, > and then if we change the policy's scaling_max_freq to be a > lower freq, indeed, the sg_policy's next_freq need change to > be the lower freq, however, because the cpu_is_busy, the next_freq > would keep the max_freq. > > For example: > The cpu7 is single cpu: > > unisoc:/sys/devices/system/cpu/cpufreq/policy7 # while true;do done& > [1] 4737 > unisoc:/sys/devices/system/cpu/cpufreq/policy7 # taskset -p 80 4737 > pid 4737's current affinity mask: ff > pid 4737's new affinity mask: 80 > unisoc:/sys/devices/system/cpu/cpufreq/policy7 # cat scaling_max_freq > 2301000 > unisoc:/sys/devices/system/cpu/cpufreq/policy7 # cat scaling_cur_freq > 2301000 > unisoc:/sys/devices/system/cpu/cpufreq/policy7 # echo 2171000 > scaling_max_freq > unisoc:/sys/devices/system/cpu/cpufreq/policy7 # cat scaling_max_freq > 2171000 > > At this time, the sg_policy's next_freq would keep 2301000. > > To prevent the case happen, add the judgment of the need_freq_update flag. > > Signed-off-by: Xuewen Yan > Co-developed-by: Guohua Yan > Signed-off-by: Guohua Yan > --- > kernel/sched/cpufreq_schedutil.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c > index 4492608b7d7f..458d359f5991 100644 > --- a/kernel/sched/cpufreq_schedutil.c > +++ b/kernel/sched/cpufreq_schedutil.c > @@ -350,7 +350,8 @@ static void sugov_update_single_freq(struct update_util_data *hook, u64 time, > * Except when the rq is capped by uclamp_max. > */ > if (!uclamp_rq_is_capped(cpu_rq(sg_cpu->cpu)) && > - sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq) { > + sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq && > + !sg_policy->need_freq_update) { > next_f = sg_policy->next_freq; > > /* Restore cached freq as next_freq has changed */ Just wondering about the status of this fix - is it pending in some tree, or should we apply it to the scheduler tree? Thanks, Ingo