Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2895946rdb; Mon, 12 Feb 2024 23:46:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVZgoMWeL2Fl8Vkp/QwZYHE6iq1gKnuPsuUBHQ7xfyF+aDCWyekdqDvSY2qEL4puX42i/k/DZzWGhrTV/p5GSe0VkIQ8foC1Dt6CMFWdA== X-Google-Smtp-Source: AGHT+IEVRFQCr622PCAZfcyLuCpm4uMQaPA1Qeejh4pM0wabJnO34yphmq5TNPSyswrQNrPaCbMJ X-Received: by 2002:aa7:8089:0:b0:6e0:a2c6:9c9f with SMTP id v9-20020aa78089000000b006e0a2c69c9fmr7372939pff.31.1707810392626; Mon, 12 Feb 2024 23:46:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707810392; cv=pass; d=google.com; s=arc-20160816; b=MLlnSsmFkpnCHuXd6IXDRTbbTLu2jbtZ5YCaJunvQ+MLS6/pepy0C9j1dfICwk9Zw8 P3L5qYvVl7NEGTJDukgIk8lIDHfjkyWELrPKY3oEA1QJw2S6x4GY61BlTIB+LbccuntY ZDAE8AooCjFvckdkGM+6IDjAOJF451szVu1zxSWld/ABaCwzRglciyLpKRlsKi9xUeRU I/SaNCT6DjeSuFSMUSQgdWnOKBfWvP4TeCDX7QXU5Y4kKEPLEPAoY5MRsRxlxvf1vp4f eDUpPJlkPqqYo3qWA8+Wgs9i2t4nInPFW3aa/CYNIY2+KbFg7imcE8KaoQss9oh278HW 2L+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=Wc/cvXAJMHLqdf3OgGzlHdpWHxevmYx69ypRgOrbw4o=; fh=Rj+DrYc2RY0EAceKcC3x60kMipho2FAorLm17jrfTx0=; b=BL6ImwMQKH8/82SbKpln1IG5DeVMJbxkbdVSO4pK3yj0Zbmi5vHBPEn12Yor+XoM9X u+F0MVL0HYWbGSdTARDFfgO4EJgsY+MBEnKHGhcKXQcWz8wj/JXWBPITF1qSgIOTDB/x IYQY8bzaB60tlnnHSal6mqKR3NPvkTr6dVvfA6IzZj+3LTkGyi2sjs17Z3REX+ws321c n0Yi2UdItxJILAgFt8cDzsu24FenPhKD91HiqQLeT7XwvbQqrdh+oQ3MxLM1z+eKZj2u /xh8YFRQUDhCC8lRBjaoUsAd4VTx4CbhMIuVafQWKaCTykVW8wmocOBLfxTGnW6XvIxk 1CUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="wRp4y+/g"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-63054-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63054-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCUmvZdJiT6gCOdCAEdPq1zHx2AFYp3k9WMk5r2YGZNPRp7BTALivqcxsrA0aLDmIrInL/DY6Ude0mhhlKledqzMtpozW4+jhP8hwU3TLQ== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y35-20020a056a00182300b006e07c71b75fsi6388895pfa.355.2024.02.12.23.46.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 23:46:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63054-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; dkim=pass header.i=@linaro.org header.s=google header.b="wRp4y+/g"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-63054-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63054-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 B55FEB2271D for ; Tue, 13 Feb 2024 07:46:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7526F1775F; Tue, 13 Feb 2024 07:46:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wRp4y+/g" Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C003F17755 for ; Tue, 13 Feb 2024 07:46:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707810370; cv=none; b=Cn05WP/V8VRRdx+v5b/ByZuoZplAloVMo/Nt6vuwOLkLw00+ZOfA4XTE4lqJdxvhaRh2wRnaZCd+XxHdeknXHySKtYT5qstArcFHXiNVgL39vpIew4fvDICrLb370Oig5WOxJvGZ/KKPdCq3DH5u1mO6hn3c+PGXhY3hO5rGLUc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707810370; c=relaxed/simple; bh=PbF29hTerpeueYCgRClBIMeyfQqY4j9lUKkhK8ynkQI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=kQFH/kVTgm8MoCWvAAvCABNLhY/ahAGoojVkBzfwEDuH2dEnjVwqbtLXvIq+gw6ZvU6FeD1Tk5NY5AtCtPCTR+GTPrq8UcJmEiLZSIC2l8rkZH4bsg3PjhSEh+AZgeZ4DRrvr1sMLYsmGuOXHKnorAgz7KaQCMb+sU+oCPKxsHk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wRp4y+/g; arc=none smtp.client-ip=209.85.216.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-295c67ab2ccso2349834a91.1 for ; Mon, 12 Feb 2024 23:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707810368; x=1708415168; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Wc/cvXAJMHLqdf3OgGzlHdpWHxevmYx69ypRgOrbw4o=; b=wRp4y+/gtEfFppzCMSKb2hLFGsgZTEDfWWnktQV8A10PLkaWfolNWQepNo+IOMgb/j 9byLsclPFVXSqkyc1FPx5loPJSqQROLN1IAdToojFu3ti18np5DUyWQ6SyG4RsP2fkAX hULwyclSR0JCyrtexoADJi7kgS08QXbruYV8grLzSSVBoD5qDC4ekn8pN7HRFMWVO5x+ Furne9o8JfPdFZAM3vZ55ET0dZQIIQ/CN1sxWIQWNoU0M7uLhTwSCvKjFZS3s4qovq1x BNoG0coWxRHjkaAuF7kCVIlLbKNCgmfLKYLkoXD+UEHUvGENlKnZlWve+9c84ElIIN3q /avQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707810368; x=1708415168; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Wc/cvXAJMHLqdf3OgGzlHdpWHxevmYx69ypRgOrbw4o=; b=mZqc5IPUrPmshM30Jil4nmMC+qRPLl0Y/QoWvWEa4FMDgAkef2twu/YC9IpyE3pPdk v2PKRLR+YmKJVgrDEM4vS5hNsww8dRT01ZjC+di/EkQpfYwFmoBSjWMDzlJ1OEzPZVT5 2WCreRiLnvZDEEjHV7od7ZudMkHMMZcTAjEKZQjvCP6dAXnWq3htny02PREZzs99umgv 5THU98XusD/Q2KRkAihBkVlkcnLBA1faX9me4/2QUWbMI905hhVl4vQj6qwSm/sBzLJP i4utWTK+97rCuamPVXZA1BsCpvh1F9MvTp1z6RiHYDphQj5ndLmLGG34nnS1gzqQLHtU afsQ== X-Forwarded-Encrypted: i=1; AJvYcCVlz6orGLT7Ozk8wa/lsBJOZXBr3Q4bW0V38uoEu9n7XclBrmNmDbLFXUErlDBOJzMx64JOeQqWkOSAMbu+75K20sm+VcEvIAyxl/76 X-Gm-Message-State: AOJu0Yy5sUwQx/Mk/kHrYQ+I/+Sg6Pah6h6i6gYb/Ki7gbCB6IMq9mVw d7C8Kxvtd7NhAhbTZhyTRnJEVEp4543ps16LpEG3STmogvmJEq04q6Ec6MrPvdtRPzoIfPP1Wyu D2eryL7TS90gFp5gTB2Fe7FmbtuSvOvlT7kCSjQ== X-Received: by 2002:a17:90a:a38b:b0:297:1927:71ed with SMTP id x11-20020a17090aa38b00b00297192771edmr4510101pjp.6.1707810367904; Mon, 12 Feb 2024 23:46:07 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240211074950.247836-1-zhaoyang.huang@unisoc.com> In-Reply-To: <20240211074950.247836-1-zhaoyang.huang@unisoc.com> From: Vincent Guittot Date: Tue, 13 Feb 2024 08:45:56 +0100 Message-ID: Subject: Re: [PATCH] sched: make cpu_util_cfs visible To: "zhaoyang.huang" Cc: Mel Gorman , Peter Zijlstra , Ingo Molnar , Juri Lelli , linux-kernel@vger.kernel.org, Zhaoyang Huang , steve.kang@unisoc.com Content-Type: text/plain; charset="UTF-8" On Sun, 11 Feb 2024 at 08:50, zhaoyang.huang wrote: > > 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. We expect a user of this to be sent as part of the patchset > > 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 You have to use *_avg with care if you want to get such figures because they do not only reflect the last task activation but an average of the past dozens of ms so you can easily get wrong figures. > > 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 >