Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp192749lqt; Thu, 6 Jun 2024 00:07:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlCE/jHiUDJ47ajLbJ6XhpoS5oB6RjWdGiqTGYyhgPn/yG3E4aGZhtIRkh2gBcscyCQRHsaU9r1sZdHCwh+ARVmswaG1gdxaWVK15JGw== X-Google-Smtp-Source: AGHT+IEQLER0r28wLMKK96HEnhcPSQkwSBrwVtZwKcmQSIF0moP/qPcqrff563AuifDZyI9Y6FpV X-Received: by 2002:a17:906:3498:b0:a58:e8c7:c0b8 with SMTP id a640c23a62f3a-a699f361c21mr288791566b.7.1717657654188; Thu, 06 Jun 2024 00:07:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717657654; cv=pass; d=google.com; s=arc-20160816; b=msE3FZpzPuLhA8U2H1g2cZoEpu1DmeUSUkFDY+C4fV7+QcWOVCzAKtRDoN5+0XIg9X 0gCC1fCnIk14ZAQVjUvQPya3V5X1bYTr7UtI8z1UzKYe/woh7ewjwoDGquEPeZjzDrNO j6aK/zFFAez8JC09eml3+sFI5GFVc5riwCrVS1rXEeAqkYPuXzBDcNpPmE7l5lay+lQ+ a4Ho6xtmdj2DPtjIHHFO1K+ZCyJodjoQHkvnp/rir78xbl/ZhzeGKg0gKwTkkrdA5Avn gzO0DtkCTKncfNpBV0MPulqWByAK4f19DCPJ8VGM5TO0b3XJ0PH76eEbRdlD6Kee5041 ySig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=/gfSCn0rp0TjT3v6Q+WyfCB0P7267ZrYXyG1iv3f2Sg=; fh=liYdv0eRyIGcuFQ1Kb5mPhGSHLMZEuTDXm954Cco0u4=; b=VP89098iMEARVq+jFb74ueYK0I80r30FjS8v24gb2kWdgciulRyWRfFTdUwQ4GxIgm VmBPeKYKFoPisxwyFPxl/Bbhie30ftmm4ExpNT3NLHHyM60FgT9QOz7rwU6PYLOmBQBW unbXVcPNx8CorkGu1bOJiIfrGUdYi2CzPscowXLICnJ++LLwDL1f0y6psoD4puZUDBpS oFjEbPMxDmBdFUvU4R3+ViGvh9LXMxqPzjVbgqK/w3jqHAQLbS99YRIFwOdvW7sPSaPZ uLXVzQoW/7sDC96hwgt0+TCKAkK+gYRlO5qYTAPsPYVx2oegSUjohTT9ACv/jaGV+3Nt mNjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-203706-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203706-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c8058da9asi38372066b.192.2024.06.06.00.07.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 00:07:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203706-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-203706-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203706-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E32C51F25032 for ; Thu, 6 Jun 2024 07:07:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 639ED13AD0E; Thu, 6 Jun 2024 07:07:26 +0000 (UTC) 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: 8bit Content-Type: text/plain X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL:SHSQR01.spreadtrum.com 45676xmS037336 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 utilization in feec()") Signed-off-by: Xuewen Yan --- 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_env *eenv, for_each_cpu(cpu, pd_cpus) { unsigned long util = cpu_util(cpu, p, -1, 0); - busy_time += effective_cpu_util(cpu, util, NULL, NULL); + util = effective_cpu_util(cpu, util, NULL, NULL); + util = min(eenv->cpu_cap, util); + busy_time += util; } eenv->pd_busy_time = min(eenv->pd_cap, busy_time); -- 2.25.1