Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-03-01 Thread Peter Zijlstra
On Wed, Mar 01, 2017 at 11:19:22AM -0500, Steven Rostedt wrote: > On Wed, 1 Mar 2017 17:03:52 +0100 > Peter Zijlstra wrote: > > > On Wed, Mar 01, 2017 at 10:53:03AM -0500, Steven Rostedt wrote: > > > Peter, do we have a solution for this yet? Are you going to add the one >

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-03-01 Thread Peter Zijlstra
On Wed, Mar 01, 2017 at 11:19:22AM -0500, Steven Rostedt wrote: > On Wed, 1 Mar 2017 17:03:52 +0100 > Peter Zijlstra wrote: > > > On Wed, Mar 01, 2017 at 10:53:03AM -0500, Steven Rostedt wrote: > > > Peter, do we have a solution for this yet? Are you going to add the one > > > with the linker

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-03-01 Thread Peter Zijlstra
On Wed, Mar 01, 2017 at 10:53:03AM -0500, Steven Rostedt wrote: > Peter, do we have a solution for this yet? Are you going to add the one > with the linker magic? I queued the below earlier today. --- Subject: sched: Fix pick_next_task() for RT,DL From: Peter Zijlstra

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-03-01 Thread Peter Zijlstra
On Wed, Mar 01, 2017 at 10:53:03AM -0500, Steven Rostedt wrote: > Peter, do we have a solution for this yet? Are you going to add the one > with the linker magic? I queued the below earlier today. --- Subject: sched: Fix pick_next_task() for RT,DL From: Peter Zijlstra Date: Wed Mar 1 10:51:47

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-03-01 Thread Steven Rostedt
On Wed, 1 Mar 2017 17:03:52 +0100 Peter Zijlstra wrote: > On Wed, Mar 01, 2017 at 10:53:03AM -0500, Steven Rostedt wrote: > > Peter, do we have a solution for this yet? Are you going to add the one > > with the linker magic? > > I queued the below earlier today. Isn't

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-03-01 Thread Steven Rostedt
On Wed, 1 Mar 2017 17:03:52 +0100 Peter Zijlstra wrote: > On Wed, Mar 01, 2017 at 10:53:03AM -0500, Steven Rostedt wrote: > > Peter, do we have a solution for this yet? Are you going to add the one > > with the linker magic? > > I queued the below earlier today. Isn't this pretty much

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-03-01 Thread Steven Rostedt
On Thu, 23 Feb 2017 20:45:06 +0530 Pavan Kondeti wrote: > Hi Peter, > > On Thu, Feb 23, 2017 at 7:24 PM, Peter Zijlstra wrote: > > On Thu, Feb 23, 2017 at 04:04:22PM +0530, Pavan Kondeti wrote: > >> Hi Peter, > >> > >> > diff --git

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-03-01 Thread Steven Rostedt
On Thu, 23 Feb 2017 20:45:06 +0530 Pavan Kondeti wrote: > Hi Peter, > > On Thu, Feb 23, 2017 at 7:24 PM, Peter Zijlstra wrote: > > On Thu, Feb 23, 2017 at 04:04:22PM +0530, Pavan Kondeti wrote: > >> Hi Peter, > >> > >> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > >> > index

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-27 Thread Steven Rostedt
Sorry, for the late reply. Just got back from traveling. On Thu, 23 Feb 2017 18:54:38 +0100 Peter Zijlstra wrote: > On Thu, Feb 23, 2017 at 06:45:05PM +0100, Peter Zijlstra wrote: > > Hurm.. maybe we should do what Steve initially suggested. The > > alternative is link

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-27 Thread Steven Rostedt
Sorry, for the late reply. Just got back from traveling. On Thu, 23 Feb 2017 18:54:38 +0100 Peter Zijlstra wrote: > On Thu, Feb 23, 2017 at 06:45:05PM +0100, Peter Zijlstra wrote: > > Hurm.. maybe we should do what Steve initially suggested. The > > alternative is link order trickery, and I'm

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Peter Zijlstra
On Thu, Feb 23, 2017 at 06:45:05PM +0100, Peter Zijlstra wrote: > Hurm.. maybe we should do what Steve initially suggested. The > alternative is link order trickery, and I'm not sure we want to do that. That is, given: kernel/sched/Makefile: obj-y += idle_task.o fair.o rt.o deadline.o

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Peter Zijlstra
On Thu, Feb 23, 2017 at 06:45:05PM +0100, Peter Zijlstra wrote: > Hurm.. maybe we should do what Steve initially suggested. The > alternative is link order trickery, and I'm not sure we want to do that. That is, given: kernel/sched/Makefile: obj-y += idle_task.o fair.o rt.o deadline.o

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Peter Zijlstra
On Thu, Feb 23, 2017 at 10:59:15PM +0530, Pavan Kondeti wrote: > On Thu, Feb 23, 2017 at 10:07 PM, Peter Zijlstra wrote: > > On Thu, Feb 23, 2017 at 04:25:33PM +0100, Peter Zijlstra wrote: > >> > >> Ah, I read your question wrong. Yes I think you're right, we now loose > >>

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Peter Zijlstra
On Thu, Feb 23, 2017 at 10:59:15PM +0530, Pavan Kondeti wrote: > On Thu, Feb 23, 2017 at 10:07 PM, Peter Zijlstra wrote: > > On Thu, Feb 23, 2017 at 04:25:33PM +0100, Peter Zijlstra wrote: > >> > >> Ah, I read your question wrong. Yes I think you're right, we now loose > >> the pull when the last

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Pavan Kondeti
On Thu, Feb 23, 2017 at 10:07 PM, Peter Zijlstra wrote: > On Thu, Feb 23, 2017 at 04:25:33PM +0100, Peter Zijlstra wrote: >> >> Ah, I read your question wrong. Yes I think you're right, we now loose >> the pull when the last RT task goes away. >> >> Hmm.. how to fix that

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Pavan Kondeti
On Thu, Feb 23, 2017 at 10:07 PM, Peter Zijlstra wrote: > On Thu, Feb 23, 2017 at 04:25:33PM +0100, Peter Zijlstra wrote: >> >> Ah, I read your question wrong. Yes I think you're right, we now loose >> the pull when the last RT task goes away. >> >> Hmm.. how to fix that nicely.. > > Something

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Peter Zijlstra
On Thu, Feb 23, 2017 at 04:25:33PM +0100, Peter Zijlstra wrote: > > Ah, I read your question wrong. Yes I think you're right, we now loose > the pull when the last RT task goes away. > > Hmm.. how to fix that nicely.. Something like so perhaps? This would make a pull happen when the last RT

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Peter Zijlstra
On Thu, Feb 23, 2017 at 04:25:33PM +0100, Peter Zijlstra wrote: > > Ah, I read your question wrong. Yes I think you're right, we now loose > the pull when the last RT task goes away. > > Hmm.. how to fix that nicely.. Something like so perhaps? This would make a pull happen when the last RT

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Peter Zijlstra
On Thu, Feb 23, 2017 at 08:45:06PM +0530, Pavan Kondeti wrote: > Hi Peter, > > On Thu, Feb 23, 2017 at 7:24 PM, Peter Zijlstra wrote: > > On Thu, Feb 23, 2017 at 04:04:22PM +0530, Pavan Kondeti wrote: > >> Hi Peter, > >> > >> > diff --git a/kernel/sched/core.c

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Peter Zijlstra
On Thu, Feb 23, 2017 at 08:45:06PM +0530, Pavan Kondeti wrote: > Hi Peter, > > On Thu, Feb 23, 2017 at 7:24 PM, Peter Zijlstra wrote: > > On Thu, Feb 23, 2017 at 04:04:22PM +0530, Pavan Kondeti wrote: > >> Hi Peter, > >> > >> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > >> > index

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Pavan Kondeti
Hi Peter, On Thu, Feb 23, 2017 at 7:24 PM, Peter Zijlstra wrote: > On Thu, Feb 23, 2017 at 04:04:22PM +0530, Pavan Kondeti wrote: >> Hi Peter, >> >> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c >> > index 49ce1cb..51ca21e 100644 >> > --- a/kernel/sched/core.c >>

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Pavan Kondeti
Hi Peter, On Thu, Feb 23, 2017 at 7:24 PM, Peter Zijlstra wrote: > On Thu, Feb 23, 2017 at 04:04:22PM +0530, Pavan Kondeti wrote: >> Hi Peter, >> >> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c >> > index 49ce1cb..51ca21e 100644 >> > --- a/kernel/sched/core.c >> > +++

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Peter Zijlstra
On Thu, Feb 23, 2017 at 04:04:22PM +0530, Pavan Kondeti wrote: > Hi Peter, > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index 49ce1cb..51ca21e 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -3321,15 +3321,14 @@ static inline void

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Peter Zijlstra
On Thu, Feb 23, 2017 at 04:04:22PM +0530, Pavan Kondeti wrote: > Hi Peter, > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index 49ce1cb..51ca21e 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -3321,15 +3321,14 @@ static inline void

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Pavan Kondeti
Hi Peter, > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 49ce1cb..51ca21e 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -3321,15 +3321,14 @@ static inline void schedule_debug(struct task_struct > *prev) > static inline struct task_struct * >

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-02-23 Thread Pavan Kondeti
Hi Peter, > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 49ce1cb..51ca21e 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -3321,15 +3321,14 @@ static inline void schedule_debug(struct task_struct > *prev) > static inline struct task_struct * >

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-01-20 Thread Peter Zijlstra
On Fri, Jan 20, 2017 at 11:14:25AM -0500, Steven Rostedt wrote: > > OK, so I hate this patch because it makes the condition more complex, > > and while staring at what it does for code generation I couldn't for the > > life of me figure out why we care about prev->sched_class to begin with. > > I

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-01-20 Thread Peter Zijlstra
On Fri, Jan 20, 2017 at 11:14:25AM -0500, Steven Rostedt wrote: > > OK, so I hate this patch because it makes the condition more complex, > > and while staring at what it does for code generation I couldn't for the > > life of me figure out why we care about prev->sched_class to begin with. > > I

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-01-20 Thread Steven Rostedt
On Fri, 20 Jan 2017 11:14:25 -0500 Steven Rostedt wrote: > > > > > Could you give it a spin to see if anything comes apart? > > Yeah this works. You can add: > > Reported-by: Steven Rostedt (VMware) > Tested-by: Steven Rostedt (VMware)

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-01-20 Thread Steven Rostedt
On Fri, 20 Jan 2017 11:14:25 -0500 Steven Rostedt wrote: > > > > > Could you give it a spin to see if anything comes apart? > > Yeah this works. You can add: > > Reported-by: Steven Rostedt (VMware) > Tested-by: Steven Rostedt (VMware) > You can also add that my likely profiler on a

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-01-20 Thread Steven Rostedt
On Thu, 19 Jan 2017 18:44:08 +0100 Peter Zijlstra wrote: - if (likely(prev->sched_class == class && > > + if (likely((prev->sched_class == class || > > + prev->sched_class == idle_class) && > >rq->nr_running == rq->cfs.h_nr_running)) {

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-01-20 Thread Steven Rostedt
On Thu, 19 Jan 2017 18:44:08 +0100 Peter Zijlstra wrote: - if (likely(prev->sched_class == class && > > + if (likely((prev->sched_class == class || > > + prev->sched_class == idle_class) && > >rq->nr_running == rq->cfs.h_nr_running)) { > > OK, so I hate

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-01-19 Thread Peter Zijlstra
On Thu, Jan 19, 2017 at 10:17:03AM -0500, Steven Rostedt wrote: > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 154fd68..e2c6d3b 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -3259,13 +3259,15 @@ static inline struct task_struct * > pick_next_task(struct rq

Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-01-19 Thread Peter Zijlstra
On Thu, Jan 19, 2017 at 10:17:03AM -0500, Steven Rostedt wrote: > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 154fd68..e2c6d3b 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -3259,13 +3259,15 @@ static inline struct task_struct * > pick_next_task(struct rq

[PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-01-19 Thread Steven Rostedt
When running my likely/unlikely profiler, I noticed that the SCHED_DEADLINE's pick_next_task_dl() unlikely case of (!dl_rq->dl_nr_running) was always being hit. There's two cases where this can happen. First, there's an optimization in pick_next_task() for the likely case that the only tasks

[PATCH] sched: Optimize pick_next_task for idle_sched_class too

2017-01-19 Thread Steven Rostedt
When running my likely/unlikely profiler, I noticed that the SCHED_DEADLINE's pick_next_task_dl() unlikely case of (!dl_rq->dl_nr_running) was always being hit. There's two cases where this can happen. First, there's an optimization in pick_next_task() for the likely case that the only tasks