Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3222166pxu; Tue, 8 Dec 2020 06:42:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTfRS/+AYfz7xlfNSnACx6PvLd/F0p71SiiOCAsX77wCpaiT5rm22ITwACJi67Z5a01ud9 X-Received: by 2002:a17:906:7687:: with SMTP id o7mr23742889ejm.209.1607438525981; Tue, 08 Dec 2020 06:42:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607438525; cv=none; d=google.com; s=arc-20160816; b=XorVwDibjnRzHqSAvd34zL3+7YN+YVfP1Wg5cC1C3J0qRfq+Cvkxx5uGfVMgYVsaUL zkh0zcTUOOw4fPeWkTEXMakeF+4HdKAF24mD9h5va4Irmp5TXvh/JyKZAuoZHVryzW/J LIDNpDDuYQLAss46GGcD7ntNkZ2BBLiTOcllE74OpRuPupwNqKX+GgSlRcBLBSNZzAEe T9hEkJ7SJLM/iL/Ce7WEXQD/Z7ppoNiGgGbWTQYtgnawBIftSxtV27oidl3+tHoRIQX1 EKIdxaE4+AcT4bryqxyc+XPzB0HHbuqJH8GTtbFw5eXxQ1QUire7c8I1OOhz/nHnhh5G bYyg== 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=7Gxx5iIVZ+aQ5EtHOkmbor982WkWB+Ely0P1hHAVlMI=; b=hcKwzQ4DOG89xBxjwfAo/pqK6Z5wtmBTCgM4p4wPBUZ69t9a/2zeI9RDrjlKJ5AjB3 sFdLq+HdK9MQuiEZfMdh45eKYTrqLasZK8Fb02/2EN0aD6EEHkCxDemBHWebQEB8vf8x lx+Eh4+wlB+Q811yPRlBOsNAL860fjJXi5qByab0rzN3304d6JHDTqEsxzHftJhGARC6 BsuWwv52YPqau20YFQ1WPAtQfd730ZlDTIOIjY4eaQDkyCN8hngt7qd6DWHOLt34Rgpi oK36hTfBUaTS2LE0gTiGtRPEiMzB2Z7gOnrtJm2YgqoLntMqB9/4wLF+YVehEoHEBDUB /t4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q19si8091911ejc.594.2020.12.08.06.41.35; Tue, 08 Dec 2020 06:42:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729586AbgLHOhp (ORCPT + 99 others); Tue, 8 Dec 2020 09:37:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:49588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726080AbgLHOho (ORCPT ); Tue, 8 Dec 2020 09:37:44 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0171423A6C; Tue, 8 Dec 2020 14:37:02 +0000 (UTC) Date: Tue, 8 Dec 2020 09:37:01 -0500 From: Steven Rostedt To: "peterz@infradead.org" , "linux-kernel@vger.kernel.org" Cc: Tianxianting , "mingo@redhat.com" , "juri.lelli@redhat.com" , "vincent.guittot@linaro.org" , "dietmar.eggemann@arm.com" , "bsegall@google.com" , "mgorman@suse.de" Subject: Re: [PATCH] sched/rt: Print curr when RT throttling activated Message-ID: <20201208093701.3a890235@gandalf.local.home> In-Reply-To: References: <20201203075129.17902-1-tian.xianting@h3c.com> <20201203093956.6dd8a753@gandalf.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter? -- Steve On Tue, 8 Dec 2020 07:58:54 +0000 Tianxianting wrote: > Thanks, > We met an issue that a normal thread can't get cpu, > And at this moment, we found 'sched: RT throttling activated' log. > > So I think this patch is useful for such issue. > > Could I get more comments? Thanks in advance > -----Original Message----- > From: Steven Rostedt [mailto:rostedt@goodmis.org] > Sent: Thursday, December 03, 2020 10:40 PM > To: tianxianting (RD) > 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; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] sched/rt: Print curr when RT throttling activated > > On Thu, 3 Dec 2020 15:51:29 +0800 > Xianting Tian wrote: > > > We may meet the issue, that one RT thread occupied the cpu by > > 950ms/1s, The RT thread maybe is a business thread or other unknown thread. > > > > Currently, it only outputs the print "sched: RT throttling activated" > > when RT throttling happen. It is hard to know what is the RT thread, > > For further analysis, we need add more prints. > > > > This patch is to print current RT task when RT throttling activated, > > It help us to know what is the RT thread in the first time. > > I think this can be useful information to include. > > Acked-by: Steven Rostedt (VMware) > > -- Steve > > > > > Signed-off-by: Xianting Tian > > --- > > kernel/sched/rt.c | 7 ++++--- > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index > > f215eea6a..8913f38cb 100644 > > --- a/kernel/sched/rt.c > > +++ b/kernel/sched/rt.c > > @@ -946,7 +946,7 @@ static inline int rt_se_prio(struct sched_rt_entity *rt_se) > > return rt_task_of(rt_se)->prio; > > } > > > > -static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq) > > +static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq, struct > > +task_struct *curr) > > { > > u64 runtime = sched_rt_runtime(rt_rq); > > > > @@ -970,7 +970,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("sched: RT throttling activated (curr: pid %d, comm %s)\n", > > + curr->pid, curr->comm); > > } else { > > /* > > * In case we did anyway, make it go away, @@ -1026,7 +1027,7 @@ > > static void update_curr_rt(struct rq *rq) > > if (sched_rt_runtime(rt_rq) != RUNTIME_INF) { > > raw_spin_lock(&rt_rq->rt_runtime_lock); > > rt_rq->rt_time += delta_exec; > > - if (sched_rt_runtime_exceeded(rt_rq)) > > + if (sched_rt_runtime_exceeded(rt_rq, curr)) > > resched_curr(rq); > > raw_spin_unlock(&rt_rq->rt_runtime_lock); > > }