Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3045650rwd; Mon, 22 May 2023 07:59:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7rMWmxMqJVFnm/0jMvf5daiWYnmk3+XO8k+ULxtX4QxCWCmjx5Mh3IDTbTxfebqgLkxL1M X-Received: by 2002:a17:90a:3043:b0:253:5c1b:104d with SMTP id q3-20020a17090a304300b002535c1b104dmr9945102pjl.33.1684767597330; Mon, 22 May 2023 07:59:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684767597; cv=none; d=google.com; s=arc-20160816; b=SIZK/keaPPqzq64K7vvXtjs0Mco+ibY+ZQmOqUMTGYtwHpPJtu4bumI6BrSFebyN7o FHgDvcvRsY0CjMLzdzMi/5ARW8ZwZUEekp2OTmNB/jjAwOdlOx7QX7QNEL1OcJIjuwda grG2TtkV4MR+NrbyR6tdtzL1CctLDKNJlvOD5uAdMRTpLxrkSl9wj77wOTs5Z2101LIv zHbV2AwgQdQn9cFvTVCpXa3/YpQxCNRbJJgtIzZhoA8hD80TNdqErF52QRrWH4wTHSEw bL5HfTNaGmiKzmxroP8jrvEPfHTQ9YX3m/YLfX++9v/gArjCCzxMChsHi4C6nJHlxG4o Gp1w== 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=h1mhe5CVXSiFL/vzwRglfECYgstHYiLhh3V2qfkRdILkGlJkQasrpMu1DR1vtgetS1 Cdr8ztl3dA+aXJBCZvh9lQhYc9Oj5Yn6shxJZIY9kizrKaB2AO/9Wc/jsFYyG/ePEef8 etPrOHvSHeLCWe+muOt76+Q8aMoWPU2ULCe9hariN0IgNmPNW3ZIn4Vc4P8OphQBpJhE +SpAmPMdGBaCOmDuqTyHYICUJwMZoM+LjPrVLn7K6+Wh1uy/U/Q3c5VUctWKC9qRWSD/ w3fSk99NYLUN40dFgNEv5mxVHSML7dVDHkiL5x0NP8oyROczBlQ4Rv5GTJK7JelXH0xj 9Fiw== 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 v189-20020a6389c6000000b0053b8f80c623si2194283pgd.448.2023.05.22.07.59.42; Mon, 22 May 2023 07:59:57 -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 S231829AbjEVO5Y (ORCPT + 99 others); Mon, 22 May 2023 10:57:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234031AbjEVO5Q (ORCPT ); Mon, 22 May 2023 10:57:16 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 15FD1C4; Mon, 22 May 2023 07:57:14 -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 C62181480; Mon, 22 May 2023 07:57:58 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.22.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 942F33F6C4; Mon, 22 May 2023 07:57:10 -0700 (PDT) From: Lukasz Luba To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, rafael@kernel.org, linux-pm@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: [RESEND][PATCH v2 1/3] sched/tp: Add new tracepoint to track uclamp set from user-space Date: Mon, 22 May 2023 15:57:00 +0100 Message-Id: <20230522145702.2419654-2-lukasz.luba@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230522145702.2419654-1-lukasz.luba@arm.com> References: <20230522145702.2419654-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