[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180710230917.GA187293@joelaf.mtv.corp.google.com>
Date: Tue, 10 Jul 2018 16:09:17 -0700
From: Joel Fernandes <joel@...lfernandes.org>
To: Dietmar Eggemann <dietmar.eggemann@....com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
Morten Rasmussen <morten.rasmussen@....com>,
Patrick Bellasi <patrick.bellasi@....com>,
Quentin Perret <quentin.perret@....com>,
kernel-team@...roid.com, Joel Fernandes <joelaf@...gle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sched/fair: Remove setting task's se->runnable_weight
during PELT update
On Mon, Jul 09, 2018 at 05:47:53PM +0100, Dietmar Eggemann wrote:
> A CFS (SCHED_OTHER, SCHED_BATCH or SCHED_IDLE policy) task's
> se->runnable_weight must always be in sync with its se->load.weight.
>
> se->runnable_weight is set to se->load.weight when the task is
> forked (init_entity_runnable_average()) or reniced (reweight_entity()).
>
> There are two cases in set_load_weight() which since they currently only
> set se->load.weight could lead to a situation in which se->load.weight
> is different to se->runnable_weight for a CFS task:
>
> (1) A task switches to SCHED_IDLE.
>
> (2) A SCHED_FIFO, SCHED_RR or SCHED_DEADLINE task which has been reniced
> (during which only its static priority gets set) switches to
> SCHED_OTHER or SCHED_BATCH.
>
> Set se->runnable_weight to se->load.weight in these two cases to prevent
> this. This eliminates the need to explicitly set it to se->load.weight
> during PELT updates in the CFS scheduler fastpath.
Looks good to me. By the way just asking, is there a chance where
se_weight(se) and se_runnable(se) can ever be different? Seems not, then in
that case we pointlessly do this division in ___update_load_avg if the sa
belongs to the task:
sa->load_avg = div_u64(load * sa->load_sum, divider);
sa->runnable_load_avg = div_u64(runnable * sa->runnable_load_sum, divider);
and we could probably just do this if se is a task?
sa->load_avg = div_u64(load * sa->load_sum, divider);
sa->runnable_load_avg = sa->load_avg;
thanks,
-Joel
Powered by blists - more mailing lists