From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2DBE837DEA2 for ; Wed, 18 Mar 2026 12:54:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773838496; cv=none; b=YABat3WIFdrHR4x08ZRW9m7VboRzlEih4Mv03lIVkkrgzL67R8HVh/7STX0FVAKGpkyDmeYNYcMmAaUA2jP0nUWHOzIlEBc0SeHUzttvTJlGnGTfB26Nc5tJytfP0WGJZ7vpBxdrhrfMEz8clc442AimGhGSiG7p4WlHLnkl/fo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773838496; c=relaxed/simple; bh=EXAHv8MPeOVKvKgNwQPAlBkX69c+b1ZK6dtk8McilGo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=UDpCPZCGDHOnRF91L2CudyHUV4E5Hgibx7gAvq3uUikfZ7R7oxA56CWBEEkCmIJw/d/Z2W+Czzxct9JbhVb+JLiUjoTHCXRIdErFdsoxwQm7ri07drTBA0zeQV8QSo/XEmqhaGnK3ew6ZH0lXUsCtj2FH00NZGeb/lpzMDvVzGo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CF6761E7D; Wed, 18 Mar 2026 05:54:45 -0700 (PDT) Received: from [10.57.17.91] (unknown [10.57.17.91]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 81E6C3F778; Wed, 18 Mar 2026 05:54:48 -0700 (PDT) Message-ID: <043a188b-d2ba-4797-8a51-c4b1c9e2a5ee@arm.com> Date: Wed, 18 Mar 2026 12:54:46 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH] sched: Add scx_cpuperf_target in sched_cpu_util() To: Xuewen Yan , peterz@infradead.org, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, tj@kernel.org Cc: dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, lukasz.luba@arm.com, linux-kernel@vger.kernel.org, rui.zhang@intel.com, di.shen@unisoc.com, ke.wang@unisoc.com, xuewen.yan94@gmail.com References: <20260318121755.16354-1-xuewen.yan@unisoc.com> Content-Language: en-US From: Christian Loehle In-Reply-To: <20260318121755.16354-1-xuewen.yan@unisoc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 3/18/26 12:17, Xuewen Yan wrote: > Recently, while enabling sched-ext debugging, we observed abnormal behavior > in our thermal power_allocator’s temperature control. > Through debugging, we found that the CPU util was too low, causing > the CPU frequency to remain unrestricted. > > This issue stems from the fact that in the sched_cpu_util() function, > when scx is enabled, cpu_util_cfs becomes zero. As a result, > the thermal subsystem perceives an extremely low CPU utilization, > which degrades the effectiveness of the power_allocator’s control. > > To address this, we propose adding scx_cpuperf_target in the sched_cpu_util() > as a replacement for cpu_util_cfs, ensuring that the thermal subsystem receives > accurate load information and restores proper control behavior. > > Reported-by: Di Shen > Signed-off-by: Xuewen Yan Fixes: d86adb4fc0655 ("sched_ext: Add cpuperf support")? > --- > kernel/sched/fair.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index bf948db905ed..20adb6fede2a 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -8198,7 +8198,12 @@ unsigned long effective_cpu_util(int cpu, unsigned long util_cfs, > > unsigned long sched_cpu_util(int cpu) > { > - return effective_cpu_util(cpu, cpu_util_cfs(cpu), NULL, NULL); > + unsigned long util = scx_cpuperf_target(cpu); > + > + if (!scx_switched_all()) > + util += cpu_util_cfs(cpu); > + > + return effective_cpu_util(cpu, util, NULL, NULL); > } > > /* Ah right, I guess it's not as good as sugov as there's no guarantee it behaves somewhat low-pass-filterish, but better than nothing. No idea if it's worth factoring out this and sugov_get_util, maybe not given that sugov includes ('temporary') cfs runnable boost while sched_cpu_util() doesn't.