From patchwork Fri Sep 29 08:39:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 146453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3871365vqu; Fri, 29 Sep 2023 01:39:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbrXIPpqbvwduNhYEnKbHalxtuyjX5JygJXPFecVYcr+OnVCP8NPX02iOUKmDLiNZ8ztT+ X-Received: by 2002:a17:903:1205:b0:1c3:9928:7b28 with SMTP id l5-20020a170903120500b001c399287b28mr5087608plh.6.1695976791194; Fri, 29 Sep 2023 01:39:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695976791; cv=none; d=google.com; s=arc-20160816; b=vz+T15ocpJrIkJmBthhG2swwQdIukD/SC+wIosT6T5c1rD9lQsonnWku3kkgsn0Scg kl/hPtR/yTwFyw1UPjH/QnAIHOhQ3elW7Obv3cLnbMAYvu6IqHEbL85o0AAwuitKPWvB 96nbXmT7rBHU5snqcVSIzBmRw9/2R5zZGhvlLgNk06cj3VM1vZLZFtGUqaDXiX/q+IKF rZQ1kaHDg9aORCaRIIIZeM83u7giE1hGGCV/9ha670vidd3GgMII5h6+U6PkMVY5cyYc NIZCBUPEggC07rXiK+6x4H+jkXc1jN3CSVz9flM+k6ylKGKQPl7IcLGQ8g0U6UMFOf+F 6vDQ== 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 header.s=2020e header.b=WAlnZPKi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id b12-20020a170902d50c00b001c724cd1128si7927908plg.276.2023.09.29.01.39.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 01:39:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; 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 header.s=2020e header.b=WAlnZPKi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 3C70883B85E0; Fri, 29 Sep 2023 01:39:47 -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 S232912AbjI2Ijd (ORCPT + 20 others); Fri, 29 Sep 2023 04:39:33 -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 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:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778360559706554623 X-GMAIL-MSGID: 1778360559706554623 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; } /*