Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5709318rwr; Tue, 9 May 2023 05:29:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4YLMV+ACWkBx42PZM6rtg4IJyK6Xv++sDboRoHJpAjciNkzLnvV+xQh2PGacC0MdhwMnsK X-Received: by 2002:a17:90b:390e:b0:24b:27e1:92fc with SMTP id ob14-20020a17090b390e00b0024b27e192fcmr13127084pjb.44.1683635339819; Tue, 09 May 2023 05:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683635339; cv=none; d=google.com; s=arc-20160816; b=QTNyLg8pH4y4si471qy+zpfH3wnhtRkl30YbXCfVuXxodUcFfOURRCPAL9+nxFHBa0 lp2uK0J13H9nadx30pNtEtP3JqhgxPugjE/RncMB8T2d+mI4SmZWd7nfJ8kKxgrTe9iZ HVlgldIGKwRal5VBF1tQSKYubUVaR8E8OtE2oz5IvmfB8aMHGmw8CdtBAqED22ZiQbQV xOvyGBEGMDa/AJuxcj9N1/MSqhUYKYg2Il4TUx6rYHYrcY5Cs3XLm2Bf/7dc6Pd52vcH IAU+CBck5wbimTwvahIXFcAQpja/PmYkAZoxM68GueLfmvIKkMBVFuCWjZCzwI4pXXbE Q0Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Yh7a98dPw1veYwbHjK1FjNNHH9CRPXSyuLFvHSlShIE=; b=o1qL4gxubYizLtyX9AXg29jgRCxDEw7bMBBYiGm1kaJkxrDbeR9GdtNhKGQD0jhlIj sKxFVVSGiqTv9e/Jrc9DuAzgmCvCZ/X63hgLU1lH6XWgHtY27V668MZ6EKkF0mienpBs 09TnxQ/OCbtWITxMVR8rou6le2z5fiyTxfrNLG/m4FSFSczPvry5eulkQ35cjmYwKIAy wCCnKvFLWMjrlohndFDY3ciyRd5ni2rUO0qUSpq1MGDXguj7QLk0//lD9ApRgGMVwXH5 HoJ4mbyS3rCqXUtywnZRn0rSjVMBSoo0H8x50rpqoFta/bw7mYqEFOGrvtXpkb67oBQe FAPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g126-20020a636b84000000b0052c9d173ef6si1311055pgc.852.2023.05.09.05.28.47; Tue, 09 May 2023 05:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235712AbjEIMXE (ORCPT + 99 others); Tue, 9 May 2023 08:23:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234246AbjEIMW7 (ORCPT ); Tue, 9 May 2023 08:22:59 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BA97019A9; Tue, 9 May 2023 05:22:58 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F28A21063; Tue, 9 May 2023 05:23:42 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.22.29]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B1D593F67D; Tue, 9 May 2023 05:22:55 -0700 (PDT) From: Lukasz Luba To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: rostedt@goodmis.org, mhiramat@kernel.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, delyank@fb.com, lukasz.luba@arm.com, qyousef@google.com, qyousef@layalina.io Subject: [PATCH v2 1/3] sched/tp: Add new tracepoint to track uclamp set from user-space Date: Tue, 9 May 2023 13:22:44 +0100 Message-Id: <20230509122246.1702397-2-lukasz.luba@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230509122246.1702397-1-lukasz.luba@arm.com> References: <20230509122246.1702397-1-lukasz.luba@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The user-space can set uclamp value for a given task. It impacts task placement decisions made by the scheduler. This is very useful information and helps to understand the system behavior or track improvements in middleware and applications which start using uclamp mechanisms and report better performance in tests. Signed-off-by: Lukasz Luba --- include/trace/events/sched.h | 4 ++++ kernel/sched/core.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index fbb99a61f714..dbfb30809f15 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -735,6 +735,10 @@ DECLARE_TRACE(sched_update_nr_running_tp, TP_PROTO(struct rq *rq, int change), TP_ARGS(rq, change)); +DECLARE_TRACE(uclamp_update_tsk_tp, + TP_PROTO(struct task_struct *tsk, int uclamp_id, unsigned int value), + TP_ARGS(tsk, uclamp_id, value)); + #endif /* _TRACE_SCHED_H */ /* This part must be outside protection */ diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 944c3ae39861..7b9b800ebb6c 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(uclamp_update_tsk_tp); DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); @@ -1956,12 +1957,16 @@ static void __setscheduler_uclamp(struct task_struct *p, attr->sched_util_min != -1) { uclamp_se_set(&p->uclamp_req[UCLAMP_MIN], attr->sched_util_min, true); + trace_uclamp_update_tsk_tp(p, UCLAMP_MIN, + attr->sched_util_min); } if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MAX && attr->sched_util_max != -1) { uclamp_se_set(&p->uclamp_req[UCLAMP_MAX], attr->sched_util_max, true); + trace_uclamp_update_tsk_tp(p, UCLAMP_MAX, + attr->sched_util_max); } } -- 2.25.1