Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6282863rwl; Wed, 22 Mar 2023 08:39:33 -0700 (PDT) X-Google-Smtp-Source: AK7set8iX+OtQxF5gk9VmW+a5KhsgDBT6OLEqQIuau9klvAItbHBaxZQVPahm7UcJ6orhAMYSs6F X-Received: by 2002:aa7:db4f:0:b0:500:50f6:dd30 with SMTP id n15-20020aa7db4f000000b0050050f6dd30mr7536970edt.15.1679499573534; Wed, 22 Mar 2023 08:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679499573; cv=none; d=google.com; s=arc-20160816; b=ZKDJuDIDK5bCIjbLXschZkQV0cMGp8cSU5xTDQyQdWVkg1IBIwzPj/0F/kfljtyzuX qHMCb54LCoxwOPkUTWiHCQDc0Sy5MlVPpROhKRudOY9CQYftKjrshMETeg5iTx3k1HFI Rg6FWtLzmYMtLfiv+4g4lFHTvyxJ1NiT5IUDx/QOVNK6N6TOXwfK+M7bM6kOGHWai8O4 MsIp/0dbz+BAHGCTEojlwfXkOqjSUW6qG1+gPzElVEHLZcc/aCmYvAlcVsR6WLl7sKSI MrlOTRZ08Vq3n6EzvPyNZRonK5wjlVNG7Qjt36tJCB5RMc8H8Y5gD5e7898GcvL18lNL S0Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=M/zhULCHA1XSZ1Q171tTn9PBYyckisFrE89Od7KPEKY=; b=O7oPM3DmJnmft3eHDJ3qAbEaavYxkb5DDYf9G44bjoEcspo60hwcVYkxI8JltwWo0m uyoeIHxIAyeMI80QrWs+G7mT52PRU37gyIVWP7PmdDU4SjGTFS44cfbKJyv99zJYl3yy WCENirdSup+3X3mF1yst4A7paDfCsChctthMkkyk/PQJE4ttWuOPDNwIPUoi8dtyMorn Pc64heQm9RiBi5ZKZKyKHJULDLhfLPRm0jAnPDLXoDWLggrNsvM5ViJZ9Oh1ascqyrxy 0o40E46lqUNZUuTwst9djzMomwgSHDCKoxXyOt4/muI1gj/zWL1P8euTywLQYcrUZCCQ LiVQ== 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 w22-20020a50fa96000000b004ad15601457si15839011edr.629.2023.03.22.08.39.09; Wed, 22 Mar 2023 08:39:33 -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 S231600AbjCVPUS (ORCPT + 99 others); Wed, 22 Mar 2023 11:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231538AbjCVPUP (ORCPT ); Wed, 22 Mar 2023 11:20:15 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AA838591E0; Wed, 22 Mar 2023 08:20: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 755B4AD7; Wed, 22 Mar 2023 08:20:58 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.18.173]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C8DC73F71E; Wed, 22 Mar 2023 08:20:11 -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 Subject: [PATCH 1/3] sched/tp: Add new tracepoint to track uclamp set from user-space Date: Wed, 22 Mar 2023 15:18:41 +0000 Message-Id: <20230322151843.14390-2-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230322151843.14390-1-lukasz.luba@arm.com> References: <20230322151843.14390-1-lukasz.luba@arm.com> X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 488655f2319f..882c92e3ccf0 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -110,6 +110,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); @@ -1936,12 +1937,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.17.1