[Devel,rh7] sched: Fix cfs_rq->active assignment in sched_cfs_active_timer()

Submitted by Kirill Tkhai on Sept. 7, 2016, 9:53 a.m.

Details

Message ID 147324199829.32404.4242588311513763393.stgit@pro
State New
Series "sched: Fix cfs_rq->active assignment in sched_cfs_active_timer()"
Headers show

Commit Message

Kirill Tkhai Sept. 7, 2016, 9:53 a.m.
sched_cfs_active_timer() is used to postpone decrementing of
tg->nr_cpus_active and marking cfs_rq as inactive. It's need
to give a possibility for a new tg task to stand on a hot cpu,
where another tg's task gone to sleep a moment ago.

See for dec_nr_active_cfs_rqs(), which postpone actions it does.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 kernel/sched/fair.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 515685f..34eb09d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -510,7 +510,7 @@  static enum hrtimer_restart sched_cfs_active_timer(struct hrtimer *timer)
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&rq->lock, flags);
-	cfs_rq->active = !!list_empty(&cfs_rq->tasks);
+	cfs_rq->active = !list_empty(&cfs_rq->tasks);
 	raw_spin_unlock_irqrestore(&rq->lock, flags);
 
 	atomic_dec(&cfs_rq->tg->nr_cpus_active);

Comments

Andrey Ryabinin Sept. 8, 2016, 9:14 a.m.
On 09/07/2016 12:53 PM, Kirill Tkhai wrote:
> sched_cfs_active_timer() is used to postpone decrementing of
> tg->nr_cpus_active and marking cfs_rq as inactive. It's need
> to give a possibility for a new tg task to stand on a hot cpu,
> where another tg's task gone to sleep a moment ago.
> 
> See for dec_nr_active_cfs_rqs(), which postpone actions it does.
> 
> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>

Reviewed-by: Andrey Ryabinin <aryabinin@virtuozzo.com>

> ---
>  kernel/sched/fair.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 515685f..34eb09d 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -510,7 +510,7 @@ static enum hrtimer_restart sched_cfs_active_timer(struct hrtimer *timer)
>  	unsigned long flags;
>  
>  	raw_spin_lock_irqsave(&rq->lock, flags);
> -	cfs_rq->active = !!list_empty(&cfs_rq->tasks);
> +	cfs_rq->active = !list_empty(&cfs_rq->tasks);
>  	raw_spin_unlock_irqrestore(&rq->lock, flags);
>  
>  	atomic_dec(&cfs_rq->tg->nr_cpus_active);
> 
> _______________________________________________
> Devel mailing list
> Devel@openvz.org
> https://lists.openvz.org/mailman/listinfo/devel
>