Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3410704rwb; Fri, 9 Dec 2022 14:15:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf70PK2RafjVGsMmSuQUDaV7h92wjzC6Sw3aUVOSU33c/B+9MOn0CldY/J9yjApFKaBsBU06 X-Received: by 2002:a05:6a20:9b9a:b0:ab:fe5a:df95 with SMTP id mr26-20020a056a209b9a00b000abfe5adf95mr9018717pzb.15.1670624118800; Fri, 09 Dec 2022 14:15:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670624118; cv=none; d=google.com; s=arc-20160816; b=iDmt/vqrkjOP+sWd4B3B9A7wGhQ53JYNniR3djv98/xjvQv/27Ckoyf+zHzn38PQNu OT4Kdpm2X+YMxExPx0AaE27gwhUxOx5zMAWuimr2/2HqsdwGuA8IjNJStynebL9/pg47 9vhcPLcqKcFYUzzkuCG7TNZiXL06Rb/upYVHMTgMVLO/oJskk1NWgjR0vb1FD0s0p8aQ mRgWOAS9nJqfhbZuXl/jyR91zWtoUHA0AwzUrY+2V26fMdQcjpaBftpwx3etJ8c74SVa r/X7US3c7hKyYvBWyJWKgfqaK3svbIq9DSHt/whl1YFF0wcZHljF4Czl7WWLJ4+oU+nX lkXw== 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:subject:cc:to:from:date; bh=4+CY77mtoGXw/4AIjLmyIXwtxfVtjq+wj08lV8SOFxY=; b=owQ3B9S2lB3AL2S/v3yWocu50vkWaabDDyHmDcsUCJ7eCd+1Plu53q5ojRqG2bVPnt tY421TADoj+d37123FwgEgedZpEMKujG+iOgZysV4C81dHVYJuAelHzDeoyt8B2k8lFr TjHvPiCEPVup7PDDKLJqDUYZd3JW+u5ANNZA8AJ088aKh+UfYFeKZi8lS4J97ET3qw3t 1fX+9Tswo+JowJQ3N9Nj1CIgRHKwwMZrDaxxlugc/rYuPEPC5ocKk7/fWsG68pruAPo5 c3o6Tz9oK3v/SX4E//DBy8gHftWoD+fksk9sY0A5WsSqVfGRLQhWTw2gCPB3PXRHUjGV zO9g== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p21-20020a63f455000000b0047060a55c40si2485005pgk.712.2022.12.09.14.15.08; Fri, 09 Dec 2022 14:15:18 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229960AbiLIVgQ (ORCPT + 74 others); Fri, 9 Dec 2022 16:36:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbiLIVgO (ORCPT ); Fri, 9 Dec 2022 16:36:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC220AC6F9 for ; Fri, 9 Dec 2022 13:36:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C94E9B828ED for ; Fri, 9 Dec 2022 21:36:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DA23C433F0; Fri, 9 Dec 2022 21:36:08 +0000 (UTC) Date: Fri, 9 Dec 2022 16:36:06 -0500 From: Steven Rostedt To: Yajun Deng Cc: 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, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched/rt: Add pid and comm when RT throttling activated Message-ID: <20221209163606.53a2370e@gandalf.local.home> In-Reply-To: <20221206083641.103832-1-yajun.deng@linux.dev> References: <20221206083641.103832-1-yajun.deng@linux.dev> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS 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 On Tue, 6 Dec 2022 16:36:41 +0800 Yajun Deng wrote: > It is difficult to know which process consumes time when RT throttling > activated. > > So add pid and comm for this case. > Unfortunately, that only shows the process that "broke the camel's back"[1]. The things is, it is the amount of time *all* RT tasks use to trigger throttling. You are only printing the task that the throttling occurred on. Try running https://rostedt.org/code/migrate.c . It will create a bunch of RT tasks, and they all will throttle once it hits 950ms ever second. trace-cmd record -e sched_switch ./migrate kernelshark Then plot all the migrate tasks. The above will demonstrate it very well. -- Steve [1] https://en.wikipedia.org/wiki/Straw_that_broke_the_camel%27s_back > Signed-off-by: Yajun Deng > --- > kernel/sched/rt.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c > index ed2a47e4ddae..1f267ab1b59a 100644 > --- a/kernel/sched/rt.c > +++ b/kernel/sched/rt.c > @@ -1012,6 +1012,7 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq) > > if (rt_rq->rt_time > runtime) { > struct rt_bandwidth *rt_b = sched_rt_bandwidth(rt_rq); > + struct task_struct *curr = rq_of_rt_rq(rt_rq)->curr; > > /* > * Don't actually throttle groups that have no runtime assigned > @@ -1019,7 +1020,8 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq) > */ > if (likely(rt_b->rt_runtime)) { > rt_rq->rt_throttled = 1; > - printk_deferred_once("sched: RT throttling activated\n"); > + printk_deferred_once("pid: %d, comm: %s, sched: RT throttling activated\n", > + curr->pid, curr->comm); > } else { > /* > * In case we did anyway, make it go away,