From nobody Mon Feb 9 16:21:32 2026 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 64BF945942 for ; Sun, 11 Feb 2024 07:50:50 +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=1707637855; cv=none; b=VFJB9fnLzSsis3rfIpAfchW8ZbA3jV5jSKQJ056tLLnisFEpL5G3uENuAVAGHNZRdCAV1tlWnNYEKpKlf6pGiSikzKhw5biu5ZBT6S4aPf2U/WmnPjui7l0e68jTZLL9s8IbH81Nl+ocM2isRT6D2aa/N8PA/6WKX51sy7LdXEY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707637855; c=relaxed/simple; bh=jDbS45Hfpl4NJbCyiYaybSk/6ny2dT75/VCYQby8FF8=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=u4JpI+d70V5lKpYOM3QWB4raYgcRX/k0o25apo1R47A6shsOAqNjebtbk1zuEZMv99GBARaEtmWO4QeLAFVAK933khu1JOmYmXYsW5pBpFo057US2BozfuMeJR1toS0FasgmZdbVnARBJ+Q7kPCSBdRbpFKKLJmyEMrpw+0/clM= 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 41B7nvqI061257; Sun, 11 Feb 2024 15:49:57 +0800 (+08) (envelope-from zhaoyang.huang@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4TXfr62ZHJz2K4cJ4; Sun, 11 Feb 2024 15:49:42 +0800 (CST) Received: from bj03382pcu01.spreadtrum.com (10.0.73.40) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Sun, 11 Feb 2024 15:49:55 +0800 From: "zhaoyang.huang" To: Mel Gorman , Peter Zijlstra , Ingo Molnar , Juri Lelli , Vincent Guittot , , Zhaoyang Huang , Subject: [PATCH] sched: make cpu_util_cfs visible Date: Sun, 11 Feb 2024 15:49:50 +0800 Message-ID: <20240211074950.247836-1-zhaoyang.huang@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: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 41B7nvqI061257 Content-Type: text/plain; charset="utf-8" From: Zhaoyang Huang As RT, DL, IRQ time could be deemed as lost time of CFS's task, some timing value want to know the distribution of how these spread approximately by using utilization account value (nivcsw is not enough sometimes), wheras, cpu_util_cfs is not visible out side of kernel/sched, This commit would like to make it be visible. eg. Effective part of A =3D Total_time * cpu_util_cfs / sched_cpu_util Task's Timing value A Timing start | | preempted by RT, DL or IRQ |\ | This period time is nonvoluntary CPU give up, need to know how long |/ sched in again | | | Timing end Signed-off-by: Zhaoyang Huang --- include/linux/sched.h | 1 + kernel/sched/sched.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 77f01ac385f7..56953626526f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -2318,6 +2318,7 @@ static inline bool owner_on_cpu(struct task_struct *o= wner) =20 /* Returns effective CPU energy utilization, as seen by the scheduler */ unsigned long sched_cpu_util(int cpu); +unsigned long cpu_util_cfs(int cpu); #endif /* CONFIG_SMP */ =20 #ifdef CONFIG_RSEQ diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 04846272409c..46110409e0f3 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -3027,7 +3027,6 @@ static inline unsigned long cpu_util_dl(struct rq *rq) } =20 =20 -extern unsigned long cpu_util_cfs(int cpu); extern unsigned long cpu_util_cfs_boost(int cpu); =20 static inline unsigned long cpu_util_rt(struct rq *rq) --=20 2.25.1