linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH] sched/deadline: Remove if statement before clearing throttle and yielded
@ 2017-05-10 13:50 Steven Rostedt
  2017-05-11 14:01 ` Juri Lelli
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2017-05-10 13:50 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, LKML, Juri Lelli, Luca Abeni, Daniel Bristot de Oliveira

[
  This is an RFC as I didn't run any benchmarks. It just seemed a bit 
  weird to me that we would add such a check instead of just clearing
  these variables out regardless.
]

The function replenish_dl_entity() clears dl_throttled and dl_yielded,
but checks first if they are set before doing so. As these variables
are in the same cache locale of other variables being modified, there's
no advantage in checking if they are set before clearing them. But
having the compare takes slots away from the branch prediction.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index a2ce590..9748d33 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -423,10 +423,8 @@ static void replenish_dl_entity(struct sched_dl_entity *dl_se,
 		dl_se->runtime = pi_se->dl_runtime;
 	}
 
-	if (dl_se->dl_yielded)
-		dl_se->dl_yielded = 0;
-	if (dl_se->dl_throttled)
-		dl_se->dl_throttled = 0;
+	dl_se->dl_yielded = 0;
+	dl_se->dl_throttled = 0;
 }
 
 /*

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

* Re: [RFC][PATCH] sched/deadline: Remove if statement before clearing throttle and yielded
  2017-05-10 13:50 [RFC][PATCH] sched/deadline: Remove if statement before clearing throttle and yielded Steven Rostedt
@ 2017-05-11 14:01 ` Juri Lelli
  2017-05-11 17:29   ` Daniel Bristot de Oliveira
  2017-05-11 19:50   ` Peter Zijlstra
  0 siblings, 2 replies; 4+ messages in thread
From: Juri Lelli @ 2017-05-11 14:01 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Peter Zijlstra, Ingo Molnar, LKML, Luca Abeni,
	Daniel Bristot de Oliveira

Hi,

On 10/05/17 09:50, Steven Rostedt wrote:
> [
>   This is an RFC as I didn't run any benchmarks. It just seemed a bit 
>   weird to me that we would add such a check instead of just clearing
>   these variables out regardless.
> ]
> 
> The function replenish_dl_entity() clears dl_throttled and dl_yielded,
> but checks first if they are set before doing so. As these variables
> are in the same cache locale of other variables being modified, there's
> no advantage in checking if they are set before clearing them. But
> having the compare takes slots away from the branch prediction.
> 
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index a2ce590..9748d33 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -423,10 +423,8 @@ static void replenish_dl_entity(struct sched_dl_entity *dl_se,
>  		dl_se->runtime = pi_se->dl_runtime;
>  	}
>  
> -	if (dl_se->dl_yielded)
> -		dl_se->dl_yielded = 0;
> -	if (dl_se->dl_throttled)
> -		dl_se->dl_throttled = 0;
> +	dl_se->dl_yielded = 0;
> +	dl_se->dl_throttled = 0;
>  }

Looks good to me.

Peter, any particular reason why you wanted to first check the values?

Best,

- Juri

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

* Re: [RFC][PATCH] sched/deadline: Remove if statement before clearing throttle and yielded
  2017-05-11 14:01 ` Juri Lelli
@ 2017-05-11 17:29   ` Daniel Bristot de Oliveira
  2017-05-11 19:50   ` Peter Zijlstra
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Bristot de Oliveira @ 2017-05-11 17:29 UTC (permalink / raw)
  To: Juri Lelli, Steven Rostedt; +Cc: Peter Zijlstra, Ingo Molnar, LKML, Luca Abeni

On 05/11/2017 04:01 PM, Juri Lelli wrote:
> Looks good to me.
> 
> Peter, any particular reason why you wanted to first check the values?

+1

-- Daniel

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

* Re: [RFC][PATCH] sched/deadline: Remove if statement before clearing throttle and yielded
  2017-05-11 14:01 ` Juri Lelli
  2017-05-11 17:29   ` Daniel Bristot de Oliveira
@ 2017-05-11 19:50   ` Peter Zijlstra
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2017-05-11 19:50 UTC (permalink / raw)
  To: Juri Lelli
  Cc: Steven Rostedt, Ingo Molnar, LKML, Luca Abeni,
	Daniel Bristot de Oliveira

On Thu, May 11, 2017 at 03:01:16PM +0100, Juri Lelli wrote:

> > -	if (dl_se->dl_yielded)
> > -		dl_se->dl_yielded = 0;
> > -	if (dl_se->dl_throttled)
> > -		dl_se->dl_throttled = 0;
> > +	dl_se->dl_yielded = 0;
> > +	dl_se->dl_throttled = 0;
> >  }
> 
> Looks good to me.
> 
> Peter, any particular reason why you wanted to first check the values?

No idea, could be general paranoia on unconditional writes or something.

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

end of thread, other threads:[~2017-05-11 19:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-10 13:50 [RFC][PATCH] sched/deadline: Remove if statement before clearing throttle and yielded Steven Rostedt
2017-05-11 14:01 ` Juri Lelli
2017-05-11 17:29   ` Daniel Bristot de Oliveira
2017-05-11 19:50   ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).