From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 420293D646D for ; Wed, 18 Mar 2026 12:18:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=222.66.158.135 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773836318; cv=none; b=EqIMT/NnuBFCHJHVXozD38NixcQLzeLyeeQVpxwY4MF1EdZDZJ8s5c1siKIHuJeNka8e5o/iOta+UEsNqRlq8zpFOtesoDyHnTVyJDP8NpdzpT+3b7g27O4j35RaEP5nBUCwaZMNEtwQvBFXsTmsGvTW0Rw4Q/0owgbkO65aGVM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773836318; c=relaxed/simple; bh=abKdBdJXx53Kp1VrbkD0T3KwpgX7MS5DX4GW8WWmiwg=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=XJ6onM1ClaRXzFd4AFXo1aT98FzPLbhhcDgFHtCR/Bby4b2tLm+wiUR2c4YuDUwGNjEbfDbzC8Qvj3fdtVmp6bd1gpkwzUArsFc+MZL3f/cwBLBXwkhVcdodgeqRH9ibLAOhzo9b2shFkbtK6dOvwG8pnlhDoPym+T8pH4LkiY8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=unisoc.com; spf=pass smtp.mailfrom=unisoc.com; dkim=pass (2048-bit key) header.d=unisoc.com header.i=@unisoc.com header.b=HgccsjBe; arc=none smtp.client-ip=222.66.158.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=unisoc.com header.i=@unisoc.com header.b="HgccsjBe" Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 62ICIFKU076489; Wed, 18 Mar 2026 20:18:15 +0800 (+08) (envelope-from Xuewen.Yan@unisoc.com) Received: from SHDLP.spreadtrum.com (BJMBX01.spreadtrum.com [10.0.64.7]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4fbSVj3rm0z2P5n69; Wed, 18 Mar 2026 20:16:45 +0800 (CST) Received: from BJ10918NBW01.spreadtrum.com (10.0.73.73) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 18 Mar 2026 20:18:13 +0800 From: Xuewen Yan To: , , , , CC: , , , , , , , , , , Subject: [RFC PATCH] sched: Add scx_cpuperf_target in sched_cpu_util() Date: Wed, 18 Mar 2026 20:17:55 +0800 Message-ID: <20260318121755.16354-1-xuewen.yan@unisoc.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL:SHSQR01.spreadtrum.com 62ICIFKU076489 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unisoc.com; s=default; t=1773836307; bh=uMyd82/gDFGHLBlc8J4YoBbEnGSVJf8zmK76vh/2778=; h=From:To:CC:Subject:Date; b=HgccsjBevxmXCsmnaj6bh1UWREjBcrRIrmgJIO5p4ZahwEbtnlM3uYgDaIk0+Zf8n 4sXo89n8jnqNwXic9CB2mbH8RN0F68llBHtGMdFm9IZUbZeDkOjuHU6Dpm+56dZwXR V0cug/uFhihi1JD+1jbroqTNd17AUl4/5wV+RuikEUMlaG/vuFdN2btuKVRHIGuKXf hZa6GhlTyv93PoxYVXeFTxiA27VF1wi5ZahijlrcWgQq5aDcibpx7DdweXpmTXkkWC WghhdHV7EAJ0B9Me+LB5aVSoa3pcwqJ8vgVhMc3rfYYIMo1GYNAaRSl3HKJuaoNp+j AFi4IHaqUOARA== 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 --- 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); } /* -- 2.25.1