From patchwork Wed Feb 14 08:20:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhaoyang.huang" X-Patchwork-Id: 200861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1065386dyb; Wed, 14 Feb 2024 00:22:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXDc71WOey4M8boAeDTIeVd4QgepSktahRsQeJPNakdtktTPLmiMnm4TqT8hqmq6B7ryEeUkEKYiBMaMU4S4ZkS1IIlnw== X-Google-Smtp-Source: AGHT+IF67aO4stNcMTpb7bJpKsOzhwQ7KxTNVN2itfJebBhFGcm9RT6gPMmXhWj6guP6DkBim9U/ X-Received: by 2002:aa7:da0e:0:b0:561:f768:e286 with SMTP id r14-20020aa7da0e000000b00561f768e286mr1443636eds.3.1707898951625; Wed, 14 Feb 2024 00:22:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707898951; cv=pass; d=google.com; s=arc-20160816; b=eA77Vyr7ggruSzA1W3T30kbA2el0ULuyB9BdJtTkDgG7VansbUBsTNQVt89t3GZ09Z nhCfL8SHeMihbAsutPFu4JxXlrRewhMH/eP1KGKYl00wdG0V82n864XxOHBiKLctn6J8 OaT/Bx62keCqgcZkCVXv1Nn9TS00Mv64KIDUzBwJzubBQ0AQBZ+gtAfjJZgGEegx5D3L zIs1H+zWZA8g8jW/6aTMZ39iDiIh9m5d5hBGfL+LWJ3/F039W9Eva7kJzzEDCsxR0+H5 j+0qRsdfADeXCGmBWQbtSQBySIfGq24l8U0CJUEbYmFYexjQZsTLzyAYO+5+1MWYpn8t 6OXg== 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=mvyJTf7GhR1p5WnMjPBijndbAECmUxc62VGula1z/MA=; b=ByUAtHJIfFtJGl1NUuAXaDlxJHj2+Kxso9X9yH59p2q/oG5dPnBKx+jOJvjCSIIIhN p0wc/jQ5y1Ay4aqNupsKTsGJzfzpS4nb68aNlqASoHYs2aNd2LH2lV2j6gVBwwTQ49py 7kIsY/rW+B5yTWvZbvkClyG7Tfpzn4PI/naPCyo4LDaZOKxLsMb4v3bz4fdTCpVSfgbK cFcCDB56PN97RN1fqsWlJUIOIwckjxSipWxBjInnZptMi/P9giH/8SkjLzcTtpjtxL2i UfOJnD2tef5sHw8DIPHMWEI4VhYRQOnY29rS4gQf4tBCOOeED2tPEXqS6v6V5Ca/XiAx KVRg==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64864-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXJdY3yLYX+dav44AAE2d+oaosMgRfC05uQsQFt1zxAFqX5tf9HdEafXKmaAgvkAL4vLi14TQhwgWvdwI6x9LxJxESr4g== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r25-20020aa7c159000000b00561c685e7b5si2407674edp.222.2024.02.14.00.22.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 00:22:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64864-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-64864-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64864-ouuuleilei=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 07DB61F26122 for ; Wed, 14 Feb 2024 08:22:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 031A5125D8; Wed, 14 Feb 2024 08:22:17 +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 X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 41E8L77H041246 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790861850733967736 X-GMAIL-MSGID: 1790861850733967736 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)