From patchwork Sun Feb 11 07:49:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhaoyang.huang" X-Patchwork-Id: 199375 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1819054dyd; Sat, 10 Feb 2024 23:51:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUpa7xrklY9L/D7I3tKxit1I162YkGga0bxThEoe0p7axMB1kP2O7OdpCMjVD2h2MgBiMsqg5jBziPZ5M07Qvk+cW1HVA== X-Google-Smtp-Source: AGHT+IEtgzYbVIAD1/UVgXfYI2zB1ALONMwP6wdItDxtsucK1w0e2V2eb5FC6I5dzzHqkPfVj0tL X-Received: by 2002:a17:902:da8b:b0:1d7:57e1:5202 with SMTP id j11-20020a170902da8b00b001d757e15202mr8282173plx.20.1707637876243; Sat, 10 Feb 2024 23:51:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707637876; cv=pass; d=google.com; s=arc-20160816; b=fk7DlvewP74zpKIdpaa2t90eAm5KsP2uqykniC7f4p8oc+QI1NkmI2aONJ+ezlNnJW q2rFzL1tXEMIezMbTY5KrWjq35641ms7VmFEGx/+js8XZ2UZA2YhYFXehmAogEnkXAjm fHzwe+8XjOshqICD/NdF/nvEdRkf3rm/CswNB/8anay33Zo/d66rlKbDVfmHvAKUQIXW /YivKeAyysiW9TfkkcHXbDKcXkmvDboBGSxt33+K6RepN+HNVpnrEOJXWh9ks/h6S+YF yEJDJGonxzztsgE2IULRAPnbfe05v/F8TSOK7EjZ2uF9fBcxorKCguCm7vDUKnamKpJh FB/Q== 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=KQAjTK1OfEihARqRB03oMB8hqYnOHEttfYuZwZHuvlc=; b=pGp0W7seB7iQL3kyJV9wxS3ofnhavhBm2JPNaDRJUJosL9eIbRsF03PfDJ7Oabbz0j PFzL2m71Ko0WZXUSrwYzRpehTN/En4w+injwqNg9d1iucvcq6lm3UGQMYfXYonNTd6gO n+1T0Lw5xLBMd2fr7CUbhgwq3tLxMJQLLR01jl9uOIDYx6S1Y6OOtnce04SBkUEciTh2 DM7iQ94iP3xx4ejh+WSumzvlWSHRuMhNRCaRwNLYD1jrsVKUqnNLz2VKgmV5iIWNQpuk v0gAafJWkqeh9UiJpBlfBCA5TK2KmUuFl8DinLnCTtTJrWbTG3g60sCWnOHDY41eQQbr hrTA==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60647-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCUTdwpVOAdxmod+tR29G8GFdjZD9DW2F+4rDeTob8gY/N/AnY+88K22H5Aw4Z0pXM5j+2kSh+aQqWz8o0bXXXhWxhZDyQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id x10-20020a170902ea8a00b001d9a61d7bf4si4485140plb.194.2024.02.10.23.51.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 23:51:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60647-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-60647-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60647-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1F35EB22A44 for ; Sun, 11 Feb 2024 07:51:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B47844597D; Sun, 11 Feb 2024 07:50:56 +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 X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 41B7nvqI061257 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790588093862592566 X-GMAIL-MSGID: 1790588093862592566 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)