All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/deadline: dome some cleanup for push_dl_task()
@ 2020-07-06 16:04 Peng Liu
  2020-07-24  7:14 ` Juri Lelli
  0 siblings, 1 reply; 5+ messages in thread
From: Peng Liu @ 2020-07-06 16:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman

'commit 840d719604b0 ("sched/deadline: Update rq_clock of later_rq when pushing a task")'
introduced the update_rq_clock() to fix the "used-before-update" bug.

'commit f4904815f97a ("sched/deadline: Fix double accounting of rq/running bw in push & pull")'
took away the bug source(add_running_bw()).

We no longer need to update rq_clock in advance, let activate_task()
worry about that.

Signed-off-by: Peng Liu <iwtbavbm@gmail.com>
---
 kernel/sched/deadline.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 504d2f51b0d6..c3fa11f84d93 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -2104,13 +2104,7 @@ static int push_dl_task(struct rq *rq)
 
 	deactivate_task(rq, next_task, 0);
 	set_task_cpu(next_task, later_rq->cpu);
-
-	/*
-	 * 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);
-	activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
+	activate_task(later_rq, next_task, 0);
 	ret = 1;
 
 	resched_curr(later_rq);
-- 
2.20.1


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

* Re: [PATCH] sched/deadline: dome some cleanup for push_dl_task()
  2020-07-06 16:04 [PATCH] sched/deadline: dome some cleanup for push_dl_task() Peng Liu
@ 2020-07-24  7:14 ` Juri Lelli
  2020-07-24 15:31   ` Daniel Bristot de Oliveira
  2020-07-26 14:30   ` Peng Liu
  0 siblings, 2 replies; 5+ messages in thread
From: Juri Lelli @ 2020-07-24  7:14 UTC (permalink / raw)
  To: Peng Liu
  Cc: linux-kernel, mingo, peterz, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, Daniel Bristot de Oliveira

Hi,

On 07/07/20 00:04, Peng Liu wrote:
> 'commit 840d719604b0 ("sched/deadline: Update rq_clock of later_rq when pushing a task")'
> introduced the update_rq_clock() to fix the "used-before-update" bug.
> 
> 'commit f4904815f97a ("sched/deadline: Fix double accounting of rq/running bw in push & pull")'
> took away the bug source(add_running_bw()).
> 
> We no longer need to update rq_clock in advance, let activate_task()
> worry about that.
> 
> Signed-off-by: Peng Liu <iwtbavbm@gmail.com>
> ---
>  kernel/sched/deadline.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 504d2f51b0d6..c3fa11f84d93 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -2104,13 +2104,7 @@ static int push_dl_task(struct rq *rq)
>  
>  	deactivate_task(rq, next_task, 0);
>  	set_task_cpu(next_task, later_rq->cpu);
> -
> -	/*
> -	 * 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);
> -	activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
> +	activate_task(later_rq, next_task, 0);
>  	ret = 1;

The change looks good to me, since now add_running_bw() is called later
by enqueue_task_dl(), but rq_clock has already been updated by core's
enqueue_task().

Daniel, Dietmar, a second pair of eyes (since you authored the commits
above)?

I'd chage subject to something like "sched/deadline: Stop updating
rq_clock before pushing a task".

Thanks,

Juri


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

* Re: [PATCH] sched/deadline: dome some cleanup for push_dl_task()
  2020-07-24  7:14 ` Juri Lelli
@ 2020-07-24 15:31   ` Daniel Bristot de Oliveira
  2020-07-24 16:18     ` Dietmar Eggemann
  2020-07-26 14:30   ` Peng Liu
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Bristot de Oliveira @ 2020-07-24 15:31 UTC (permalink / raw)
  To: Juri Lelli, Peng Liu
  Cc: linux-kernel, mingo, peterz, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman

On 7/24/20 9:14 AM, Juri Lelli wrote:
> Hi,
> 
> On 07/07/20 00:04, Peng Liu wrote:
>> 'commit 840d719604b0 ("sched/deadline: Update rq_clock of later_rq when pushing a task")'
>> introduced the update_rq_clock() to fix the "used-before-update" bug.
>>
>> 'commit f4904815f97a ("sched/deadline: Fix double accounting of rq/running bw in push & pull")'
>> took away the bug source(add_running_bw()).
>>
>> We no longer need to update rq_clock in advance, let activate_task()
>> worry about that.
>>
>> Signed-off-by: Peng Liu <iwtbavbm@gmail.com>
>> ---
>>  kernel/sched/deadline.c | 8 +-------
>>  1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>> index 504d2f51b0d6..c3fa11f84d93 100644
>> --- a/kernel/sched/deadline.c
>> +++ b/kernel/sched/deadline.c
>> @@ -2104,13 +2104,7 @@ static int push_dl_task(struct rq *rq)
>>  
>>  	deactivate_task(rq, next_task, 0);
>>  	set_task_cpu(next_task, later_rq->cpu);
>> -
>> -	/*
>> -	 * 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);
>> -	activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
>> +	activate_task(later_rq, next_task, 0);
>>  	ret = 1;
> The change looks good to me, since now add_running_bw() is called later
> by enqueue_task_dl(), but rq_clock has already been updated by core's
> enqueue_task().
> 
> Daniel, Dietmar, a second pair of eyes (since you authored the commits
> above)?
> 
> I'd chage subject to something like "sched/deadline: Stop updating
> rq_clock before pushing a task".

Looks good to me!

Acked-by: Daniel Bristot de Oliveira <bristot@redhat.com>

Thanks
-- Daniel


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

* Re: [PATCH] sched/deadline: dome some cleanup for push_dl_task()
  2020-07-24 15:31   ` Daniel Bristot de Oliveira
@ 2020-07-24 16:18     ` Dietmar Eggemann
  0 siblings, 0 replies; 5+ messages in thread
From: Dietmar Eggemann @ 2020-07-24 16:18 UTC (permalink / raw)
  To: Daniel Bristot de Oliveira, Juri Lelli, Peng Liu
  Cc: linux-kernel, mingo, peterz, vincent.guittot, rostedt, bsegall, mgorman

On 24/07/2020 17:31, Daniel Bristot de Oliveira wrote:
> On 7/24/20 9:14 AM, Juri Lelli wrote:
>> Hi,
>>
>> On 07/07/20 00:04, Peng Liu wrote:
>>> 'commit 840d719604b0 ("sched/deadline: Update rq_clock of later_rq when pushing a task")'
>>> introduced the update_rq_clock() to fix the "used-before-update" bug.
>>>
>>> 'commit f4904815f97a ("sched/deadline: Fix double accounting of rq/running bw in push & pull")'
>>> took away the bug source(add_running_bw()).
>>>
>>> We no longer need to update rq_clock in advance, let activate_task()
>>> worry about that.
>>>
>>> Signed-off-by: Peng Liu <iwtbavbm@gmail.com>
>>> ---
>>>  kernel/sched/deadline.c | 8 +-------
>>>  1 file changed, 1 insertion(+), 7 deletions(-)
>>>
>>> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>>> index 504d2f51b0d6..c3fa11f84d93 100644
>>> --- a/kernel/sched/deadline.c
>>> +++ b/kernel/sched/deadline.c
>>> @@ -2104,13 +2104,7 @@ static int push_dl_task(struct rq *rq)
>>>  
>>>  	deactivate_task(rq, next_task, 0);
>>>  	set_task_cpu(next_task, later_rq->cpu);
>>> -
>>> -	/*
>>> -	 * 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);
>>> -	activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
>>> +	activate_task(later_rq, next_task, 0);
>>>  	ret = 1;
>> The change looks good to me, since now add_running_bw() is called later
>> by enqueue_task_dl(), but rq_clock has already been updated by core's
>> enqueue_task().
>>
>> Daniel, Dietmar, a second pair of eyes (since you authored the commits
>> above)?
>>
>> I'd chage subject to something like "sched/deadline: Stop updating
>> rq_clock before pushing a task".
> 
> Looks good to me!
> 
> Acked-by: Daniel Bristot de Oliveira <bristot@redhat.com>

Yes, makes sense to me!

Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>

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

* Re: [PATCH] sched/deadline: dome some cleanup for push_dl_task()
  2020-07-24  7:14 ` Juri Lelli
  2020-07-24 15:31   ` Daniel Bristot de Oliveira
@ 2020-07-26 14:30   ` Peng Liu
  1 sibling, 0 replies; 5+ messages in thread
From: Peng Liu @ 2020-07-26 14:30 UTC (permalink / raw)
  To: Juri Lelli
  Cc: mingo, peterz, vincent.guittot, dietmar.eggemann, rostedt,
	bsegall, mgorman, bristot, linux-kernel

On Fri, Jul 24, 2020 at 09:14:26AM +0200, Juri Lelli wrote:
> Hi,
> 
> On 07/07/20 00:04, Peng Liu wrote:
> > 'commit 840d719604b0 ("sched/deadline: Update rq_clock of later_rq when pushing a task")'
> > introduced the update_rq_clock() to fix the "used-before-update" bug.
> > 
> > 'commit f4904815f97a ("sched/deadline: Fix double accounting of rq/running bw in push & pull")'
> > took away the bug source(add_running_bw()).
> > 
> > We no longer need to update rq_clock in advance, let activate_task()
> > worry about that.
> > 
> > Signed-off-by: Peng Liu <iwtbavbm@gmail.com>
> > ---
> >  kernel/sched/deadline.c | 8 +-------
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> > index 504d2f51b0d6..c3fa11f84d93 100644
> > --- a/kernel/sched/deadline.c
> > +++ b/kernel/sched/deadline.c
> > @@ -2104,13 +2104,7 @@ static int push_dl_task(struct rq *rq)
> >  
> >  	deactivate_task(rq, next_task, 0);
> >  	set_task_cpu(next_task, later_rq->cpu);
> > -
> > -	/*
> > -	 * 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);
> > -	activate_task(later_rq, next_task, ENQUEUE_NOCLOCK);
> > +	activate_task(later_rq, next_task, 0);
> >  	ret = 1;
> 
> The change looks good to me, since now add_running_bw() is called later
> by enqueue_task_dl(), but rq_clock has already been updated by core's
> enqueue_task().
> 

Thanks for your time.

> Daniel, Dietmar, a second pair of eyes (since you authored the commits
> above)?
> 
> I'd chage subject to something like "sched/deadline: Stop updating
> rq_clock before pushing a task".
> 
> Thanks,
> 
> Juri
> 

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

end of thread, other threads:[~2020-07-26 14:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-06 16:04 [PATCH] sched/deadline: dome some cleanup for push_dl_task() Peng Liu
2020-07-24  7:14 ` Juri Lelli
2020-07-24 15:31   ` Daniel Bristot de Oliveira
2020-07-24 16:18     ` Dietmar Eggemann
2020-07-26 14:30   ` Peng Liu

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.