Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3858884rdh; Fri, 29 Sep 2023 04:46:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFF1ruyX04654G3T+Uiy1YXqIuJGZYsFnS9YhnTv6vz+SvWvOxhh4nzCqAtf0MYwaaQVzAl X-Received: by 2002:a17:90a:d14a:b0:268:2af6:e48c with SMTP id t10-20020a17090ad14a00b002682af6e48cmr6397080pjw.4.1695988019001; Fri, 29 Sep 2023 04:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695988018; cv=none; d=google.com; s=arc-20160816; b=0SKSKEbAIcsyc6uWKeNwoDIDzFj/GzU/nbc6JmPzjjLktf0aMMQfP0xLxeRPufni7h vjrvii3VL7KxSzqvJZRmrzxxv9WGT/P4qHdV8xgkD7u5iGvEVRKevN3Jm9+Eb7aHoFS8 PnDtPU0T5noiznq1EFrWgFJpmdfAgMLF2O541sdJc0ocnF0uodwd7vS+XqesGMAkwi30 xfV1ZFN4tlWvyZtgJLSWBZB1IBDj5bYBF1xVCWHGOBQYyfFSCi0JM05BLK5R1Fw4hGPD OhXyLuX6jAmASOyQoCfs51+k3BDa1ipgvw5nqFXV9/O/No7A/fjbwtpGOk9VdlPk8ked MoEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=pRW/hqRHf5LlVXHE8len/87TPg1FH9QryvIRGHSwRFI=; fh=DYVBTNyRs8GoDjdey1ASenjQ2YCLkRBCpWTyT629eDw=; b=K01zAgMpoNvPLAjnaIcg/u1qVsopLtUXxgxDKvj4r8hFLDhit6fi3cFlt/zO93zn0C whS/3YbuUjGl8qUcjNJBkgpJUDlScTIttt054WkAzZcoYL5wlDikl30kzuaC3K+AwRLX hOAuDyn3kwi94B0E09UiwaIo2xSFw2W6s2hVpiejSixQ4ar6OfgzvQ1II7jE3CyAVpql aiaKrry4zie9RMCi7mc6A88J8SCL03kWksTkffLWu+zyRztwhyNlzQTaxStHpCzOoUgP fA5DjfFS8zNFJ3qmNtc5mWzfjFU6eQKKPMX7NDjFG7+YBMNcQcHWhwL5s20tEbM4iYWb o/NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=O4Xx6Gls; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id 9-20020a17090a098900b0027906474442si1381556pjo.81.2023.09.29.04.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 04:46:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=O4Xx6Gls; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 1AB258389133; Fri, 29 Sep 2023 01:39:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232895AbjI2Ijc (ORCPT + 99 others); Fri, 29 Sep 2023 04:39:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232923AbjI2IjN (ORCPT ); Fri, 29 Sep 2023 04:39:13 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C46A8CD7; Fri, 29 Sep 2023 01:39:03 -0700 (PDT) Date: Fri, 29 Sep 2023 08:39:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695976741; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pRW/hqRHf5LlVXHE8len/87TPg1FH9QryvIRGHSwRFI=; b=O4Xx6GlsoST6ueBkLI0J+Gt+eAGyZpHIawWS0LQhzIgKQ6CzGMhZNJ457o5nLKJ4Fd3q6x xNThyZ/G1G0CKW5Wr7SehJchHgaRwz744zFvbfMNqvdVlx3eN+CKQdDlACOzDkIl9JghGs gPSwLhCIcZ6rBqUQaHCQZOOiR78R+1cUg6ixr9qCQ7OhfS61mVBpM3BqRnoYazNE2OV9SW QB3SIAvjiO7sJ1yLxSpJRM0XxFOAiIsFFX5rgRerX+E9DlZhuqqBXf0CslPOkGyjE185jy uegaBuVIq9D8r50o84Ybe6vibJssWoSAYkxmHZVi0r6TcNvpBSTh4iaRiZKVyQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695976741; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pRW/hqRHf5LlVXHE8len/87TPg1FH9QryvIRGHSwRFI=; b=WAlnZPKiG6mEcVuM3g2czbc5gymC1kdQkqV9+ZKVfpILlMWVAlBtD2VFaHb0oYU4KZVCME vsJgb07FqwAHaWDw== From: "tip-bot2 for Qais Yousef" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/debug: Add new tracepoint to track compute energy computation Cc: "Qais Yousef (Google)" , Ingo Molnar , Dietmar Eggemann , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230916232955.2099394-4-qyousef@layalina.io> References: <20230916232955.2099394-4-qyousef@layalina.io> MIME-Version: 1.0 Message-ID: <169597674098.27769.16189468145683453028.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 29 Sep 2023 01:39:45 -0700 (PDT) The following commit has been merged into the sched/core branch of tip: Commit-ID: 15874a3d27e6405e9d17595f83bd3ca1b6cab16d Gitweb: https://git.kernel.org/tip/15874a3d27e6405e9d17595f83bd3ca1b6cab16d Author: Qais Yousef AuthorDate: Sun, 17 Sep 2023 00:29:55 +01:00 Committer: Ingo Molnar CommitterDate: Fri, 29 Sep 2023 10:29:18 +02:00 sched/debug: Add new tracepoint to track compute energy computation It was useful to track feec() placement decision and debug the spare capacity and optimization issues vs uclamp_max. Signed-off-by: Qais Yousef (Google) Signed-off-by: Ingo Molnar Reviewed-by: Dietmar Eggemann Acked-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20230916232955.2099394-4-qyousef@layalina.io --- include/trace/events/sched.h | 5 +++++ kernel/sched/core.c | 1 + kernel/sched/fair.c | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index fbb99a6..a13d5d0 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -735,6 +735,11 @@ DECLARE_TRACE(sched_update_nr_running_tp, TP_PROTO(struct rq *rq, int change), TP_ARGS(rq, change)); +DECLARE_TRACE(sched_compute_energy_tp, + TP_PROTO(struct task_struct *p, int dst_cpu, unsigned long energy, + unsigned long max_util, unsigned long busy_time), + TP_ARGS(p, dst_cpu, energy, max_util, busy_time)); + #endif /* _TRACE_SCHED_H */ /* This part must be outside protection */ diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 84881a5..324980e 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -114,6 +114,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(sched_overutilized_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_est_cfs_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_est_se_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_update_nr_running_tp); +EXPORT_TRACEPOINT_SYMBOL_GPL(sched_compute_energy_tp); DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 284b0ab..e2a69af 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7600,11 +7600,16 @@ compute_energy(struct energy_env *eenv, struct perf_domain *pd, { unsigned long max_util = eenv_pd_max_util(eenv, pd_cpus, p, dst_cpu); unsigned long busy_time = eenv->pd_busy_time; + unsigned long energy; if (dst_cpu >= 0) busy_time = min(eenv->pd_cap, busy_time + eenv->task_busy_time); - return em_cpu_energy(pd->em_pd, max_util, busy_time, eenv->cpu_cap); + energy = em_cpu_energy(pd->em_pd, max_util, busy_time, eenv->cpu_cap); + + trace_sched_compute_energy_tp(p, dst_cpu, energy, max_util, busy_time); + + return energy; } /*