Re: [PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task

2018-07-20 Thread Peter Zijlstra
On Fri, Jul 20, 2018 at 05:36:06PM +0200, Daniel Bristot de Oliveira wrote:
> Am I missing something?

Nothing, I was missing why exactly this was deadline only. Figured it
out now :-)



Re: [PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task

2018-07-20 Thread Peter Zijlstra
On Fri, Jul 20, 2018 at 05:36:06PM +0200, Daniel Bristot de Oliveira wrote:
> Am I missing something?

Nothing, I was missing why exactly this was deadline only. Figured it
out now :-)



Re: [PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task

2018-07-20 Thread Juri Lelli
On 20/07/18 17:36, Daniel Bristot de Oliveira wrote:
> On 07/20/2018 02:53 PM, Juri Lelli wrote:
> > On 20/07/18 14:48, Peter Zijlstra wrote:
> >> On Fri, Jul 20, 2018 at 02:46:15PM +0200, Peter Zijlstra wrote:
> >>> On Fri, Jul 20, 2018 at 11:16:30AM +0200, Daniel Bristot de Oliveira 
> >>> wrote:
>  diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>  index fbfc3f1d368a..8b50eea4b607 100644
>  --- a/kernel/sched/deadline.c
>  +++ b/kernel/sched/deadline.c
>  @@ -2090,8 +2090,14 @@ static int push_dl_task(struct rq *rq)
>   sub_rq_bw(_task->dl, >dl);
>   set_task_cpu(next_task, later_rq->cpu);
>   add_rq_bw(_task->dl, _rq->dl);
>  +
>  +/*
>  + * Update the later_rq clock here, because the clock is used
>  + * by the cpufreq_update_util() inside __add_running_bw().
>  + */
>  +update_rq_clock(later_rq);
>   add_running_bw(_task->dl, _rq->dl);
>  -activate_task(later_rq, next_task, 0);
>  +activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
>   ret = 1;
>   
>   resched_curr(later_rq);
> >>>
> >>> Why isn't push_rt_task() affected by the very same issue?
> >>
> >> Aah, I see, its the add_running_bw() think; for which RT doesn't have a
> >> counter-part.
> > 
> > Right, but doesn't enqueue_top_rt_rq end-up being called by activate_
> > task on lowest_rq? Mmm.
> 
> 
> AFAICS we have:
> 
> push_rt_task() {
>   activate_task() {
>   enqueue_task(,,(flags=0)) {
>   if (!(flags & ENQUEUE_NOCLOCK))
>   update_rq_clock(rq);
>   enqueue_task_rt() {
>   enqueue_rt_entity() {
>   enqueue_top_rt_rq();
>   }
>   }
>   }
> }
> 
> So we will have the clock updated already...
> 
> Am I missing something?

Ah, indeed.


Re: [PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task

2018-07-20 Thread Juri Lelli
On 20/07/18 17:36, Daniel Bristot de Oliveira wrote:
> On 07/20/2018 02:53 PM, Juri Lelli wrote:
> > On 20/07/18 14:48, Peter Zijlstra wrote:
> >> On Fri, Jul 20, 2018 at 02:46:15PM +0200, Peter Zijlstra wrote:
> >>> On Fri, Jul 20, 2018 at 11:16:30AM +0200, Daniel Bristot de Oliveira 
> >>> wrote:
>  diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>  index fbfc3f1d368a..8b50eea4b607 100644
>  --- a/kernel/sched/deadline.c
>  +++ b/kernel/sched/deadline.c
>  @@ -2090,8 +2090,14 @@ static int push_dl_task(struct rq *rq)
>   sub_rq_bw(_task->dl, >dl);
>   set_task_cpu(next_task, later_rq->cpu);
>   add_rq_bw(_task->dl, _rq->dl);
>  +
>  +/*
>  + * Update the later_rq clock here, because the clock is used
>  + * by the cpufreq_update_util() inside __add_running_bw().
>  + */
>  +update_rq_clock(later_rq);
>   add_running_bw(_task->dl, _rq->dl);
>  -activate_task(later_rq, next_task, 0);
>  +activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
>   ret = 1;
>   
>   resched_curr(later_rq);
> >>>
> >>> Why isn't push_rt_task() affected by the very same issue?
> >>
> >> Aah, I see, its the add_running_bw() think; for which RT doesn't have a
> >> counter-part.
> > 
> > Right, but doesn't enqueue_top_rt_rq end-up being called by activate_
> > task on lowest_rq? Mmm.
> 
> 
> AFAICS we have:
> 
> push_rt_task() {
>   activate_task() {
>   enqueue_task(,,(flags=0)) {
>   if (!(flags & ENQUEUE_NOCLOCK))
>   update_rq_clock(rq);
>   enqueue_task_rt() {
>   enqueue_rt_entity() {
>   enqueue_top_rt_rq();
>   }
>   }
>   }
> }
> 
> So we will have the clock updated already...
> 
> Am I missing something?

Ah, indeed.


Re: [PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task

2018-07-20 Thread Daniel Bristot de Oliveira
On 07/20/2018 02:53 PM, Juri Lelli wrote:
> On 20/07/18 14:48, Peter Zijlstra wrote:
>> On Fri, Jul 20, 2018 at 02:46:15PM +0200, Peter Zijlstra wrote:
>>> On Fri, Jul 20, 2018 at 11:16:30AM +0200, Daniel Bristot de Oliveira wrote:
 diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
 index fbfc3f1d368a..8b50eea4b607 100644
 --- a/kernel/sched/deadline.c
 +++ b/kernel/sched/deadline.c
 @@ -2090,8 +2090,14 @@ static int push_dl_task(struct rq *rq)
sub_rq_bw(_task->dl, >dl);
set_task_cpu(next_task, later_rq->cpu);
add_rq_bw(_task->dl, _rq->dl);
 +
 +  /*
 +   * Update the later_rq clock here, because the clock is used
 +   * by the cpufreq_update_util() inside __add_running_bw().
 +   */
 +  update_rq_clock(later_rq);
add_running_bw(_task->dl, _rq->dl);
 -  activate_task(later_rq, next_task, 0);
 +  activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
ret = 1;
  
resched_curr(later_rq);
>>>
>>> Why isn't push_rt_task() affected by the very same issue?
>>
>> Aah, I see, its the add_running_bw() think; for which RT doesn't have a
>> counter-part.
> 
> Right, but doesn't enqueue_top_rt_rq end-up being called by activate_
> task on lowest_rq? Mmm.


AFAICS we have:

push_rt_task() {
activate_task() {
enqueue_task(,,(flags=0)) {
if (!(flags & ENQUEUE_NOCLOCK))
update_rq_clock(rq);
enqueue_task_rt() {
enqueue_rt_entity() {
enqueue_top_rt_rq();
}
}
}
}

So we will have the clock updated already...

Am I missing something?

Thanks,
-- Daniel


Re: [PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task

2018-07-20 Thread Daniel Bristot de Oliveira
On 07/20/2018 02:53 PM, Juri Lelli wrote:
> On 20/07/18 14:48, Peter Zijlstra wrote:
>> On Fri, Jul 20, 2018 at 02:46:15PM +0200, Peter Zijlstra wrote:
>>> On Fri, Jul 20, 2018 at 11:16:30AM +0200, Daniel Bristot de Oliveira wrote:
 diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
 index fbfc3f1d368a..8b50eea4b607 100644
 --- a/kernel/sched/deadline.c
 +++ b/kernel/sched/deadline.c
 @@ -2090,8 +2090,14 @@ static int push_dl_task(struct rq *rq)
sub_rq_bw(_task->dl, >dl);
set_task_cpu(next_task, later_rq->cpu);
add_rq_bw(_task->dl, _rq->dl);
 +
 +  /*
 +   * Update the later_rq clock here, because the clock is used
 +   * by the cpufreq_update_util() inside __add_running_bw().
 +   */
 +  update_rq_clock(later_rq);
add_running_bw(_task->dl, _rq->dl);
 -  activate_task(later_rq, next_task, 0);
 +  activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
ret = 1;
  
resched_curr(later_rq);
>>>
>>> Why isn't push_rt_task() affected by the very same issue?
>>
>> Aah, I see, its the add_running_bw() think; for which RT doesn't have a
>> counter-part.
> 
> Right, but doesn't enqueue_top_rt_rq end-up being called by activate_
> task on lowest_rq? Mmm.


AFAICS we have:

push_rt_task() {
activate_task() {
enqueue_task(,,(flags=0)) {
if (!(flags & ENQUEUE_NOCLOCK))
update_rq_clock(rq);
enqueue_task_rt() {
enqueue_rt_entity() {
enqueue_top_rt_rq();
}
}
}
}

So we will have the clock updated already...

Am I missing something?

Thanks,
-- Daniel


Re: [PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task

2018-07-20 Thread Juri Lelli
On 20/07/18 14:48, Peter Zijlstra wrote:
> On Fri, Jul 20, 2018 at 02:46:15PM +0200, Peter Zijlstra wrote:
> > On Fri, Jul 20, 2018 at 11:16:30AM +0200, Daniel Bristot de Oliveira wrote:
> > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> > > index fbfc3f1d368a..8b50eea4b607 100644
> > > --- a/kernel/sched/deadline.c
> > > +++ b/kernel/sched/deadline.c
> > > @@ -2090,8 +2090,14 @@ static int push_dl_task(struct rq *rq)
> > >   sub_rq_bw(_task->dl, >dl);
> > >   set_task_cpu(next_task, later_rq->cpu);
> > >   add_rq_bw(_task->dl, _rq->dl);
> > > +
> > > + /*
> > > +  * Update the later_rq clock here, because the clock is used
> > > +  * by the cpufreq_update_util() inside __add_running_bw().
> > > +  */
> > > + update_rq_clock(later_rq);
> > >   add_running_bw(_task->dl, _rq->dl);
> > > - activate_task(later_rq, next_task, 0);
> > > + activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
> > >   ret = 1;
> > >  
> > >   resched_curr(later_rq);
> > 
> > Why isn't push_rt_task() affected by the very same issue?
> 
> Aah, I see, its the add_running_bw() think; for which RT doesn't have a
> counter-part.

Right, but doesn't enqueue_top_rt_rq end-up being called by activate_
task on lowest_rq? Mmm.


Re: [PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task

2018-07-20 Thread Juri Lelli
On 20/07/18 14:48, Peter Zijlstra wrote:
> On Fri, Jul 20, 2018 at 02:46:15PM +0200, Peter Zijlstra wrote:
> > On Fri, Jul 20, 2018 at 11:16:30AM +0200, Daniel Bristot de Oliveira wrote:
> > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> > > index fbfc3f1d368a..8b50eea4b607 100644
> > > --- a/kernel/sched/deadline.c
> > > +++ b/kernel/sched/deadline.c
> > > @@ -2090,8 +2090,14 @@ static int push_dl_task(struct rq *rq)
> > >   sub_rq_bw(_task->dl, >dl);
> > >   set_task_cpu(next_task, later_rq->cpu);
> > >   add_rq_bw(_task->dl, _rq->dl);
> > > +
> > > + /*
> > > +  * Update the later_rq clock here, because the clock is used
> > > +  * by the cpufreq_update_util() inside __add_running_bw().
> > > +  */
> > > + update_rq_clock(later_rq);
> > >   add_running_bw(_task->dl, _rq->dl);
> > > - activate_task(later_rq, next_task, 0);
> > > + activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
> > >   ret = 1;
> > >  
> > >   resched_curr(later_rq);
> > 
> > Why isn't push_rt_task() affected by the very same issue?
> 
> Aah, I see, its the add_running_bw() think; for which RT doesn't have a
> counter-part.

Right, but doesn't enqueue_top_rt_rq end-up being called by activate_
task on lowest_rq? Mmm.


Re: [PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task

2018-07-20 Thread Peter Zijlstra
On Fri, Jul 20, 2018 at 02:46:15PM +0200, Peter Zijlstra wrote:
> On Fri, Jul 20, 2018 at 11:16:30AM +0200, Daniel Bristot de Oliveira wrote:
> > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> > index fbfc3f1d368a..8b50eea4b607 100644
> > --- a/kernel/sched/deadline.c
> > +++ b/kernel/sched/deadline.c
> > @@ -2090,8 +2090,14 @@ static int push_dl_task(struct rq *rq)
> > sub_rq_bw(_task->dl, >dl);
> > set_task_cpu(next_task, later_rq->cpu);
> > add_rq_bw(_task->dl, _rq->dl);
> > +
> > +   /*
> > +* Update the later_rq clock here, because the clock is used
> > +* by the cpufreq_update_util() inside __add_running_bw().
> > +*/
> > +   update_rq_clock(later_rq);
> > add_running_bw(_task->dl, _rq->dl);
> > -   activate_task(later_rq, next_task, 0);
> > +   activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
> > ret = 1;
> >  
> > resched_curr(later_rq);
> 
> Why isn't push_rt_task() affected by the very same issue?

Aah, I see, its the add_running_bw() think; for which RT doesn't have a
counter-part.


Re: [PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task

2018-07-20 Thread Peter Zijlstra
On Fri, Jul 20, 2018 at 02:46:15PM +0200, Peter Zijlstra wrote:
> On Fri, Jul 20, 2018 at 11:16:30AM +0200, Daniel Bristot de Oliveira wrote:
> > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> > index fbfc3f1d368a..8b50eea4b607 100644
> > --- a/kernel/sched/deadline.c
> > +++ b/kernel/sched/deadline.c
> > @@ -2090,8 +2090,14 @@ static int push_dl_task(struct rq *rq)
> > sub_rq_bw(_task->dl, >dl);
> > set_task_cpu(next_task, later_rq->cpu);
> > add_rq_bw(_task->dl, _rq->dl);
> > +
> > +   /*
> > +* Update the later_rq clock here, because the clock is used
> > +* by the cpufreq_update_util() inside __add_running_bw().
> > +*/
> > +   update_rq_clock(later_rq);
> > add_running_bw(_task->dl, _rq->dl);
> > -   activate_task(later_rq, next_task, 0);
> > +   activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
> > ret = 1;
> >  
> > resched_curr(later_rq);
> 
> Why isn't push_rt_task() affected by the very same issue?

Aah, I see, its the add_running_bw() think; for which RT doesn't have a
counter-part.


Re: [PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task

2018-07-20 Thread Peter Zijlstra
On Fri, Jul 20, 2018 at 11:16:30AM +0200, Daniel Bristot de Oliveira wrote:
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index fbfc3f1d368a..8b50eea4b607 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -2090,8 +2090,14 @@ static int push_dl_task(struct rq *rq)
>   sub_rq_bw(_task->dl, >dl);
>   set_task_cpu(next_task, later_rq->cpu);
>   add_rq_bw(_task->dl, _rq->dl);
> +
> + /*
> +  * Update the later_rq clock here, because the clock is used
> +  * by the cpufreq_update_util() inside __add_running_bw().
> +  */
> + update_rq_clock(later_rq);
>   add_running_bw(_task->dl, _rq->dl);
> - activate_task(later_rq, next_task, 0);
> + activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
>   ret = 1;
>  
>   resched_curr(later_rq);

Why isn't push_rt_task() affected by the very same issue?


Re: [PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task

2018-07-20 Thread Peter Zijlstra
On Fri, Jul 20, 2018 at 11:16:30AM +0200, Daniel Bristot de Oliveira wrote:
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index fbfc3f1d368a..8b50eea4b607 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -2090,8 +2090,14 @@ static int push_dl_task(struct rq *rq)
>   sub_rq_bw(_task->dl, >dl);
>   set_task_cpu(next_task, later_rq->cpu);
>   add_rq_bw(_task->dl, _rq->dl);
> +
> + /*
> +  * Update the later_rq clock here, because the clock is used
> +  * by the cpufreq_update_util() inside __add_running_bw().
> +  */
> + update_rq_clock(later_rq);
>   add_running_bw(_task->dl, _rq->dl);
> - activate_task(later_rq, next_task, 0);
> + activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
>   ret = 1;
>  
>   resched_curr(later_rq);

Why isn't push_rt_task() affected by the very same issue?