Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp421365rdh; Wed, 14 Feb 2024 00:22:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVj5sJCJ83VNXBqE99qsd1s4KPPSadU+An1pk4TI4HCdC6lsNGRleO1jnGGlQdPNA6JIhFAhQUh2tbjBis7lAY+1iGyhyLqkEBdW9uVpQ== X-Google-Smtp-Source: AGHT+IGO2LFgxpks5drfFT0Ak/Jw6XoopdGAuQeSOKMmTtEIO04rZHqAa928lfm+61QKqk+ofzjg X-Received: by 2002:a05:6a20:d39b:b0:19c:8a1a:d9a8 with SMTP id iq27-20020a056a20d39b00b0019c8a1ad9a8mr2222389pzb.42.1707898946896; Wed, 14 Feb 2024 00:22:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707898946; cv=pass; d=google.com; s=arc-20160816; b=1Jxq4Cnx4P6xRWLtFlMo7Y5bCp/3yrAwm/JPjQoikQc/AenFSb1QLcGQtaWosNPKIh 0agWCiFy9kOBHmCLRxuN04FMNtMzyWM8g2woJ6O5n9Ovf4m/BYjw8qrqbvhRJ035xmil EHDIGqSsGYcxv0INDO80UhGxzKoJBvsOCV3O5LnJSbdYn6fh3DrNm+dSf1YS90R0Vn8Q i04uTxUfWqiLZp2ckLzmo/nDMtpqUotBDzn3Fw7z1+j1ZY2AzLDDpHs7fiU02pzvXXv5 T9G+B2rK8slOV5sYWK5kM2N333ZuBQcJgpBofvbGnQ3GGvbvrCE/dktNY3uhoaHP0o/j tCNw== 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=LBuHPzLyz1Sb9s+VtYPYwELvnCSH8Pe2gV0KIt2SK1E=; fh=GDzoQdkv1vx3s4zvulvH3NIfd6LvHe+c7HU8ybTufpQ=; b=ojSi3O4iv2DqtCkckBs1Zb9pJHAVkYlXTFGjPuonpk9xx8zzxDfneJq8TBsF9lYuX5 2ih2Bj+p2yhnvbYJmjm1ZLypAaWQvBvQQ6TdNXStNtLrR5ktsYZAWaSiLWqENN+avl/w MHPxw+sQwF7QPlIqDNt4VCV0LtxkajGZpm3oxdwl08W8sPvUKD/DifL4Inw34UBOwH6+ xlgK14lCB4VP4Bj+PNFUyji8cwHzJksKFqyyaftnRPGaZLEjsCYT9om49qVlviPuaqqm Hej+17zBYfwdm3FrMFxMvXbz9hS/E0PeQiKdR2w4eBB+yeuGxNXGBaebDtBlniK/3hFe 8j9w==; 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-64864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64864-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCWh3SMYO1GUMxfjHLjq2dtUyrXsmzThPSnwSAcgVMJiY3SNqojtTkCRsAgBaqMgFuoSuwcoWMZNclojOwHvmahZQ8vp1WD2Ed/ahPkEzQ== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l30-20020a63701e000000b005d692a181d9si3307443pgc.340.2024.02.14.00.22.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 00:22:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-64864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64864-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D07F0B20BE9 for ; Wed, 14 Feb 2024 08:22:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 091A6125B3; Wed, 14 Feb 2024 08:22:16 +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 43ADC125A2 for ; Wed, 14 Feb 2024 08:22:09 +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=1707898935; cv=none; b=E1/swvE4axrR3kRi2CiicDZYZsVNFht3ZRIMfcEzD3cmtjrLbkZCgHjmLOk4B8NcUZheOeC/tHpsji8mi4IYpxcOU8YB0rIHihh6wrzFyi5lKdBC9JwE9KeKKbOAt5oyqzyA0APrhu8FARA05akGITcASQ+aAqZLO5PD6tZXJ6M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707898935; c=relaxed/simple; bh=OSOwBo1YUkCvjrsEBarilZ2Aa5ss4bNmUvwLSaUilR0=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=jN2vbVeur9Qz80pjFByeJUR2hDexOc2Ndo520/6tryL/PdlBJ9JIpqc9xbzmfL8YKzOAkFpThfXbYbEd+87ND7OeyQiG8ku/6V8oF6pTLAR7Rz4/ZroXEkdQYKqW6Igr7P9Gv5j5l1gb3WLir8yD5VZsT9RGjtrsQ8NANykYjOo= 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 41E8L77H041246; Wed, 14 Feb 2024 16:21:07 +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 4TZWNZ0PVCz2K9fjq; Wed, 14 Feb 2024 16:20:46 +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; Wed, 14 Feb 2024 16:21:05 +0800 From: "zhaoyang.huang" To: Mel Gorman , Peter Zijlstra , Ingo Molnar , Juri Lelli , Vincent Guittot , , Zhaoyang Huang , Subject: [Resend PATCH 1/1] sched: make cpu_util_cfs formally visible Date: Wed, 14 Feb 2024 16:20:55 +0800 Message-ID: <20240214082055.277572-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 41E8L77H041246 From: Zhaoyang Huang As RT, DL, IRQ time could be deemed as lost time of CFS's task, some timing value(eg. algorithm's cost which can't disable preemption) want to know the distribution of how these timing spread approximately by using utilization account value (nivcsw is not enough sometimes), OR evaluate how heavily the preemption is. However, cpu_util_cfs is not formally visible as not in include/sched.h. 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