Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2991767pxu; Tue, 8 Dec 2020 00:03:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJx4i1ZU222KvlBRPQ92LEVI3jWz/Ev1tnvTn0FxB8UUseuaozKhWdI6LEW6INIWHhsDxElp X-Received: by 2002:aa7:c603:: with SMTP id h3mr23800347edq.254.1607414628836; Tue, 08 Dec 2020 00:03:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607414628; cv=none; d=google.com; s=arc-20160816; b=OkUJhG3P/AiKWdi9uhQSeThxTsxjo7UTbRzIKOMxvOLppRRbTzuQXE9hN8qq2b1Exh yr/EioMz9VOQun3Cl0dsCMneEpNENFrejNCrOQ3zrvoHKYeeIx4iOq10VXZ9vntq0UF2 FHOkmGhfkxUHkoAqg3SMMwfYQVS/1qFqjlRSpaaESQsmjzXEoNBsTzUmFjDkTkEiAzL9 wn1j0hLroGC7QteLfrv/hfsO1MJCRpVxP1qEknowpsp/dgNN48Pywipdpqepsevxay7/ PcNEXLWgOYAGOCkADI/nSm5X+jZl+Nr94kx5kAl6a6K/jHGELfHAq1iY9jawLpMgb6AW 4mIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=O4hTQyYoSH/y3Ki1zXA5wxjnGdV8a9uNmgKHF4vPlgI=; b=SEmQ0lY2MjO3PoewIHsoBlS5p3p/2498Xz+PUMaD8rZIZJmq5Vv8rdBmdWQX58ytBL +A20j6u3JkzUIWUhrpoGXaZwTcCl6XYWe76qKP7bTTM14CV4Vv4w5oy9kwmkL3kuor+l SZu5nInuT54eOWvGp5gcCog/HhR7j8lDOfFBywEML4C2EslYlpNwqHld28O63h8zXaXW 70QCyD0+o9S2gNADX2EMPDFyi/m2wF2/NcMhAtYGqPIYey0UDOQxfTSFaulfn00RvuLP wp/fbLyXgqiCk6gw5gBfVW+FgD5FZOqwlgtm551t0NUQA93zVgBLWxY73/UPvnw/cYZO 3UuQ== 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 l2si9801603ede.232.2020.12.08.00.03.26; Tue, 08 Dec 2020 00:03:48 -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 S1727822AbgLHIA2 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 8 Dec 2020 03:00:28 -0500 Received: from smtp.h3c.com ([60.191.123.56]:56160 "EHLO h3cspam01-ex.h3c.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727420AbgLHIA2 (ORCPT ); Tue, 8 Dec 2020 03:00:28 -0500 Received: from DAG2EX01-BASE.srv.huawei-3com.com ([10.8.0.64]) by h3cspam01-ex.h3c.com with ESMTP id 0B87wqWN085203; Tue, 8 Dec 2020 15:58:52 +0800 (GMT-8) (envelope-from tian.xianting@h3c.com) Received: from DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) by DAG2EX01-BASE.srv.huawei-3com.com (10.8.0.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 8 Dec 2020 15:58:54 +0800 Received: from DAG2EX03-BASE.srv.huawei-3com.com ([fe80::5d18:e01c:bbbd:c074]) by DAG2EX03-BASE.srv.huawei-3com.com ([fe80::5d18:e01c:bbbd:c074%7]) with mapi id 15.01.2106.002; Tue, 8 Dec 2020 15:58:54 +0800 From: Tianxianting To: Steven Rostedt 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 Thread-Topic: [PATCH] sched/rt: Print curr when RT throttling activated Thread-Index: AQHWyUqT3q2oDjHX10eYLLyUvd1ib6nk66QAgAfwkIA= Date: Tue, 8 Dec 2020 07:58:54 +0000 Message-ID: References: <20201203075129.17902-1-tian.xianting@h3c.com> <20201203093956.6dd8a753@gandalf.local.home> In-Reply-To: <20201203093956.6dd8a753@gandalf.local.home> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.99.141.128] x-sender-location: DAG2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-DNSRBL: X-MAIL: h3cspam01-ex.h3c.com 0B87wqWN085203 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); > }