Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638855 > unrolled thread

[RFC][PATCH] sched/deadline: Remove if statement before clearing throttle and yielded

Started bySteven Rostedt <rostedt@goodmis.org>
First post2017-05-10 16:00 +0200
Last post2017-05-11 22:00 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [RFC][PATCH] sched/deadline: Remove if statement before clearing  throttle and yielded Steven Rostedt <rostedt@goodmis.org> - 2017-05-10 16:00 +0200
    Re: [RFC][PATCH] sched/deadline: Remove if statement before clearing  throttle and yielded Juri Lelli <juri.lelli@arm.com> - 2017-05-11 18:30 +0200
      Re: [RFC][PATCH] sched/deadline: Remove if statement before clearing  throttle and yielded Daniel Bristot de Oliveira <bristot@redhat.com> - 2017-05-11 19:40 +0200
      Re: [RFC][PATCH] sched/deadline: Remove if statement before clearing  throttle and yielded Peter Zijlstra <peterz@infradead.org> - 2017-05-11 22:00 +0200

#1638855 — [RFC][PATCH] sched/deadline: Remove if statement before clearing throttle and yielded

FromSteven Rostedt <rostedt@goodmis.org>
Date2017-05-10 16:00 +0200
Subject[RFC][PATCH] sched/deadline: Remove if statement before clearing throttle and yielded
Message-ID<tFAjM-1pF-3@gated-at.bofh.it>
[
  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;
 }
 
 /*

[toc] | [next] | [standalone]


#1639873

FromJuri Lelli <juri.lelli@arm.com>
Date2017-05-11 18:30 +0200
Message-ID<tFZ8v-dN-35@gated-at.bofh.it>
In reply to#1638855
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

[toc] | [prev] | [next] | [standalone]


#1639924

FromDaniel Bristot de Oliveira <bristot@redhat.com>
Date2017-05-11 19:40 +0200
Message-ID<tG0ee-V3-9@gated-at.bofh.it>
In reply to#1639873
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

[toc] | [prev] | [next] | [standalone]


#1639991

FromPeter Zijlstra <peterz@infradead.org>
Date2017-05-11 22:00 +0200
Message-ID<tG2pH-2dr-1@gated-at.bofh.it>
In reply to#1639873
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web