All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/rt: Print curr when RT throttling activated
@ 2020-12-03  7:51 Xianting Tian
  2020-12-03 14:39 ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Xianting Tian @ 2020-12-03  7:51 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman
  Cc: linux-kernel, Xianting Tian

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.

Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
---
 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);
 		}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/rt: Print curr when RT throttling activated
  2020-12-03  7:51 [PATCH] sched/rt: Print curr when RT throttling activated Xianting Tian
@ 2020-12-03 14:39 ` Steven Rostedt
  2020-12-08  7:58   ` Tianxianting
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2020-12-03 14:39 UTC (permalink / raw)
  To: Xianting Tian
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	bsegall, mgorman, linux-kernel

On Thu, 3 Dec 2020 15:51:29 +0800
Xianting Tian <tian.xianting@h3c.com> 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) <rostedt@goodmis.org>

-- Steve

> 
> Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
> ---
>  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);
>  		}


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] sched/rt: Print curr when RT throttling activated
  2020-12-03 14:39 ` Steven Rostedt
@ 2020-12-08  7:58   ` Tianxianting
  2020-12-08 14:37     ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Tianxianting @ 2020-12-08  7:58 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	bsegall, mgorman, linux-kernel

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) <tian.xianting@h3c.com>
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 <tian.xianting@h3c.com> 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) <rostedt@goodmis.org>

-- Steve

> 
> Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
> ---
>  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);
>  		}


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/rt: Print curr when RT throttling activated
  2020-12-08  7:58   ` Tianxianting
@ 2020-12-08 14:37     ` Steven Rostedt
  2021-01-13 23:08       ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2020-12-08 14:37 UTC (permalink / raw)
  To: peterz, linux-kernel
  Cc: Tianxianting, mingo, juri.lelli, vincent.guittot,
	dietmar.eggemann, bsegall, mgorman


Peter?

-- Steve


On Tue, 8 Dec 2020 07:58:54 +0000
Tianxianting <tian.xianting@h3c.com> 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) <tian.xianting@h3c.com>
> 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 <tian.xianting@h3c.com> 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) <rostedt@goodmis.org>
> 
> -- Steve
> 
> > 
> > Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
> > ---
> >  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);
> >  		}  


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/rt: Print curr when RT throttling activated
  2020-12-08 14:37     ` Steven Rostedt
@ 2021-01-13 23:08       ` Steven Rostedt
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2021-01-13 23:08 UTC (permalink / raw)
  To: peterz, linux-kernel
  Cc: Tianxianting, mingo, juri.lelli, vincent.guittot,
	dietmar.eggemann, bsegall, mgorman

Peter Peter? ;-)

This one looks useful as well. Simple patch.

-- Steve


On Tue, 8 Dec 2020 09:37:01 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> Peter?
> 
> -- Steve
> 
> 
> On Tue, 8 Dec 2020 07:58:54 +0000
> Tianxianting <tian.xianting@h3c.com> 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) <tian.xianting@h3c.com>
> > 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 <tian.xianting@h3c.com> 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) <rostedt@goodmis.org>
> > 
> > -- Steve
> >   
> > > 
> > > Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
> > > ---
> > >  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);
> > >  		}    
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-13 23:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03  7:51 [PATCH] sched/rt: Print curr when RT throttling activated Xianting Tian
2020-12-03 14:39 ` Steven Rostedt
2020-12-08  7:58   ` Tianxianting
2020-12-08 14:37     ` Steven Rostedt
2021-01-13 23:08       ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.