Message ID | 20221206083641.103832-1-yajun.deng@linux.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2712284wrr; Tue, 6 Dec 2022 01:08:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf4yGp0N3coYG+DUzSj90R4uAVDR1OjiH84Vo5+n9xmlRIZ3K5nXM9D6YfZLU+5O7xzrTaBT X-Received: by 2002:a17:907:d60b:b0:7bc:dbd8:184b with SMTP id wd11-20020a170907d60b00b007bcdbd8184bmr42339072ejc.110.1670317718945; Tue, 06 Dec 2022 01:08:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670317718; cv=none; d=google.com; s=arc-20160816; b=0ihRiBOQ6UWfA0ufJckKw9KJTDWVlx6vWa2xD8um/Yx69X98PN6HLCwJ6Dfq1pWVlG nUXiZNbg0IIvZRgs11ic1YBnHgYk9/ZdBZ/yPPnoNAatMrIFWcnylFNXWMSmvSkRu+u2 UL6H/5sR+0UUWhXn+jMNiW1yUdRSKEFC4ZMwmhaVvknQgTdAepiAglsss+nMoUcnAGzk 0bTrgtyAyd3AIniuwbjFTzalM9aNmKlDJ7ScZGI4wnlkeneJQc7hAbCENKTp0DcwGOVl sMSWp1tCXSeLcizr5MSro9LJu8SCKSU/UPWG/e2p5sNgZD/b1fKi9LSTR6sV/lwwEcV/ CpdA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=rziPuY01KKfy8j2XSe8zzbR1uYlLxhOS82Ju9DQEie0=; b=Y1+R/SiWBkcNFO8Wxj5gZ13vgBWTfOcqoDrzBjG+1AoLMVcgNZKcT20SYAihsf1Thb GzvEnKHwe1i8ghzW0GnhimjsXzSvA7rIz5V5csUmNKLFE4GrDyXaftOrlABb9MWKAepe 8u2gEXMqipuyF6l7TKX9CEWMoZsaHTOfNd7620tlvPZ0nSZKDP/ZV0jdUxEdLFY0lZ1v 3EcfQCVqQAizZ1G1Xaq7tYTKCumUEJFse22WtPMisH/JOnaE0ZpJawAiKhFPt1jomYce ZNuhoVolcLLM97piFfCTL781zhx0poOTe5pK/dhsRBaaFL+rWCxTPH/a/zYB8axtB2sj Pp9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=nryMVGmk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs33-20020a1709073ea100b007a7a3b40920si15102827ejc.995.2022.12.06.01.08.15; Tue, 06 Dec 2022 01:08:38 -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; dkim=pass header.i=@linux.dev header.s=key1 header.b=nryMVGmk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232801AbiLFIiX (ORCPT <rfc822;jaysivo@gmail.com> + 99 others); Tue, 6 Dec 2022 03:38:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234292AbiLFIhy (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 6 Dec 2022 03:37:54 -0500 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABFC01CFF3 for <linux-kernel@vger.kernel.org>; Tue, 6 Dec 2022 00:37:17 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1670315835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=rziPuY01KKfy8j2XSe8zzbR1uYlLxhOS82Ju9DQEie0=; b=nryMVGmkL9uPJ4ZdK9rNDqaeTLYy6XSqxo0F+d8J7kJCWgeipUNGXsAeIrK6/AAzMZI/eC PIezq6NB2SNo9csOCLKnw5Vo1klZDYo2pnceZPAIH3Pn8CveAR5enFGYhgFEKzc+U5aqJL /7JGkyTJS8DWJm3ts4yWwbq6hs9/lTA= From: Yajun Deng <yajun.deng@linux.dev> To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com Cc: linux-kernel@vger.kernel.org, Yajun Deng <yajun.deng@linux.dev> Subject: [PATCH] sched/rt: Add pid and comm when RT throttling activated Date: Tue, 6 Dec 2022 16:36:41 +0800 Message-Id: <20221206083641.103832-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751455072116636239?= X-GMAIL-MSGID: =?utf-8?q?1751455072116636239?= |
Series |
sched/rt: Add pid and comm when RT throttling activated
|
|
Commit Message
Yajun Deng
Dec. 6, 2022, 8:36 a.m. UTC
It is difficult to know which process consumes time when RT throttling
activated.
So add pid and comm for this case.
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
kernel/sched/rt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
On Tue, 6 Dec 2022 16:36:41 +0800 Yajun Deng <yajun.deng@linux.dev> 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 <yajun.deng@linux.dev> > --- > 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,
December 10, 2022 5:36 AM, "Steven Rostedt" <rostedt@goodmis.org> wrote: > On Tue, 6 Dec 2022 16:36:41 +0800 > Yajun Deng <yajun.deng@linux.dev> 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. Thanks for your patient answer, I'll test it. > > -- Steve > > [1] https://en.wikipedia.org/wiki/Straw_that_broke_the_camel's_back > >> Signed-off-by: Yajun Deng <yajun.deng@linux.dev> >> --- >> 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,
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,