Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1856713rdb; Sat, 10 Feb 2024 23:51:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVCerFT7MVHcrmmOC1u/mcvIwkOwRRMmYAzD/H4HF85ITEz2i+RKJqA7Y85uIiwFNa+q/nSNIGcOLh6X6ueMxjrASo+ryXPX72mXsuiCA== X-Google-Smtp-Source: AGHT+IH/p64THeHt8j6rHdZ/+6Ii5sUY07U2RoaVAu/1rA5VkICAh0SVLDgXuPOCCbLJS5+jgAax X-Received: by 2002:a05:6214:390c:b0:68c:4058:7383 with SMTP id nh12-20020a056214390c00b0068c40587383mr10142232qvb.5.1707637862164; Sat, 10 Feb 2024 23:51:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707637862; cv=pass; d=google.com; s=arc-20160816; b=uLi/EyHKrF9EzmhbZda3Y+AFUqq6pNBMWXB3UNMVi54y7gSaseWblSNYYJrJw4rAy8 YsxCZlW4FKvk6RujmzRT8SOz81z8qZb/hBGfwYYx8XvvrHOSrbPwXbPtuUWU5IMIv6wf /25U18ptSnuAK1r6T6u2TepxfcSbeAS5lP7pGLTGs2isCtXQzcPaOlkrBQ8WXKcrT64z 3+xduufOF3aZeGAAz2r847livCArBbV9ehD4QMcyasWL+i4x9Gc0mTzCLYyZH8p2b+5L Mp2c/okDsf8fKd0eao/QtAfdAWBwz200xLWI86/1KHyOUmLF2Jc/fqyyNtFmxdRrTvR3 iXgg== 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:to:from; bh=YZLLp74/R2ul9Jj/SH17/OG0Jwt+ywpSgbxstCs5Yps=; fh=o68szlnPehs1ofwRsKLbTK5oZUFCDEPzpOyLwMItB7s=; b=jCgi1+xYIgDL2fP/73qy2tuI+aAv1a30H3pP4BWflrTsyXp0GvehFNPP3pRf0Pcefv qX1P6RSkXIsQQ2ZxMksfnq2J3tfwkiqeWxagKBOCyb++wDKk8KTimTslejAgngHZHMMd MwFmUxzkcP+i/eLrvv+0OjSUalv15ytl4co/WgQTf6smwwact6R0Drwnl4T84INbNmcD MZHBXJwVPKV9OhstTRtMncNqR3mN3GGNHTgDUIsiDyBweO2sXdBgJ5Q1byKv89ygFcKF y/nwZyEV4DcOQF2FSVhpviCLkRWN5LkAWYdQY4YO48K6/LZu/DnjWgZx1CH3CRxTlOBG WNuA==; 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-60647-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60647-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCU7pOfAIfemywrRUQGCnwFufSrVdUGKJqcN+ZL1XuyeLxOZGd03ha6sQPl4SepZzqsjcg1RCrkv1yjXcYAb56UbRa8FCXGycL1BnRfzzA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 2-20020a05621420e200b0068cae90b087si5899933qvk.17.2024.02.10.23.51.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 23:51:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60647-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-60647-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60647-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D7BB51C2118A for ; Sun, 11 Feb 2024 07:51:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B1DB045959; Sun, 11 Feb 2024 07:50:55 +0000 (UTC) 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: 8bit Content-Type: text/plain X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL:SHSQR01.spreadtrum.com 41B7nvqI061257 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 = 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 *owner) /* 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 */ #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) } -extern unsigned long cpu_util_cfs(int cpu); extern unsigned long cpu_util_cfs_boost(int cpu); static inline unsigned long cpu_util_rt(struct rq *rq) -- 2.25.1