From nobody Thu Feb 12 23:07:35 2026 Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [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 D4324224FD for ; Thu, 6 Jun 2024 07:07:19 +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=1717657645; cv=none; b=sXhdifER1l3A2/UCja8Mq+Vpq6M9U6NbHp+nYOg80ERRkkQHENHkLIaH4PRXkV3uVQPlnZNlOXMVM64glN5cA8Y30uQuvtwzAMOTCrukThML0/rQHUPh9c+Q1HqWNslzWcSpTFkPBwzh+f4ADw3X21f1be3Bnu+cdfYTlpltI04= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717657645; c=relaxed/simple; bh=mBO2HmtvK2fIJMU1J8Uq1NGuDdwV+rRBvjv7za6eKVk=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=A3oZPU35aVnpEP5EH2zCehRa80qT1wvdgWtPugx9Z15SxLkQaX68Cua4QqchRyydkV/SOjAZgl0DVzzte82NlJcBJ1595EMka/kVA4rCTLk24OiUmfL5MLhnIKubqLnhmqZsAjmz54nfZFlj0pDoIemif6Z1aIx0GpjYgPKch9w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com; spf=pass smtp.mailfrom=unisoc.com; arc=none smtp.client-ip=222.66.158.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 45676xmS037336; Thu, 6 Jun 2024 15:06:59 +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 4VvwJd1Vznz2RCt7x; Thu, 6 Jun 2024 15:02:57 +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.23; Thu, 6 Jun 2024 15:06:57 +0800 From: Xuewen Yan To: , , , , CC: , , , , , , , , , Subject: [PATCH] sched/fair: Prevent cpu_busy_time from exceeding actual_cpu_capacity Date: Thu, 6 Jun 2024 15:06:45 +0800 Message-ID: <20240606070645.3295-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-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 45676xmS037336 Content-Type: text/plain; charset="utf-8" Because the effective_cpu_util() would return a util which maybe bigger than the actual_cpu_capacity, this could cause the pd_busy_time calculation errors. So clamp the cpu_busy_time with the eenv->cpu_cap, which is the actual_cpu_capacity. Fixes: 3e8c6c9aac42 ("sched/fair: Remove task_util from effective utilizati= on in feec()") Signed-off-by: Xuewen Yan Tested-by: Christian Loehle --- kernel/sched/fair.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 8a5b1ae0aa55..8939d725023a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7870,7 +7870,9 @@ static inline void eenv_pd_busy_time(struct energy_en= v *eenv, for_each_cpu(cpu, pd_cpus) { unsigned long util =3D cpu_util(cpu, p, -1, 0); =20 - busy_time +=3D effective_cpu_util(cpu, util, NULL, NULL); + util =3D effective_cpu_util(cpu, util, NULL, NULL); + util =3D min(eenv->cpu_cap, util); + busy_time +=3D util; } =20 eenv->pd_busy_time =3D min(eenv->pd_cap, busy_time); --=20 2.25.1