* [PATCH] sched/fair : fix reordering of enqueue_task_fair
@ 2020-03-04 15:17 Vincent Guittot
2020-03-04 17:50 ` Vincent Guittot
0 siblings, 1 reply; 2+ messages in thread
From: Vincent Guittot @ 2020-03-04 15:17 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, dietmar.eggemann, rostedt, bsegall,
mgorman, linux-kernel
Cc: pauld, parth, valentin.schneider, hdanton, zhout, Vincent Guittot
Even when a cgroup is throttled, the group se of a child cgroup can still
be enqueued and its gse->on_rq stays true. When a task is enqueued on such
child, we still have to update the load_avg and increase h_nr_running of
the throttled cfs. Nevertheless, the 1st for_each_sched_entity loop is
skipped because of gse->on_rq == true and the 2nd loop because the cfs is
throttled whereas we have to update both load_avg with the old
h_nr_running and increment h_nr_running in such case.
Note that the update of load_avg will effectively happen only once in order
to sync with the throttled time. Next call for updating load_avg will stop
early because the clock stays unchanged.
Fixes: 6d4d22468dae ("sched/fair: Reorder enqueue/dequeue_task_fair path")
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
---
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 fcc968669aea..22d827fc46c3 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5432,7 +5432,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
cfs_rq = cfs_rq_of(se);
/* end evaluation on encountering a throttled cfs_rq */
- if (cfs_rq_throttled(cfs_rq))
+ if (!se->on_rq && cfs_rq_throttled(cfs_rq))
goto enqueue_throttle;
update_load_avg(cfs_rq, se, UPDATE_TG);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sched/fair : fix reordering of enqueue_task_fair
2020-03-04 15:17 [PATCH] sched/fair : fix reordering of enqueue_task_fair Vincent Guittot
@ 2020-03-04 17:50 ` Vincent Guittot
0 siblings, 0 replies; 2+ messages in thread
From: Vincent Guittot @ 2020-03-04 17:50 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, linux-kernel
Cc: Phil Auld, Parth Shah, Valentin Schneider, Hillf Danton, Tao Zhou
On Wed, 4 Mar 2020 at 16:17, Vincent Guittot <vincent.guittot@linaro.org> wrote:
>
> Even when a cgroup is throttled, the group se of a child cgroup can still
> be enqueued and its gse->on_rq stays true. When a task is enqueued on such
> child, we still have to update the load_avg and increase h_nr_running of
> the throttled cfs. Nevertheless, the 1st for_each_sched_entity loop is
> skipped because of gse->on_rq == true and the 2nd loop because the cfs is
> throttled whereas we have to update both load_avg with the old
> h_nr_running and increment h_nr_running in such case.
>
> Note that the update of load_avg will effectively happen only once in order
> to sync with the throttled time. Next call for updating load_avg will stop
> early because the clock stays unchanged.
>
> Fixes: 6d4d22468dae ("sched/fair: Reorder enqueue/dequeue_task_fair path")
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---
Please ignore this patch, it's not enough to fix all cases
> 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 fcc968669aea..22d827fc46c3 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5432,7 +5432,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
> cfs_rq = cfs_rq_of(se);
>
> /* end evaluation on encountering a throttled cfs_rq */
> - if (cfs_rq_throttled(cfs_rq))
> + if (!se->on_rq && cfs_rq_throttled(cfs_rq))
> goto enqueue_throttle;
>
> update_load_avg(cfs_rq, se, UPDATE_TG);
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-04 17:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-04 15:17 [PATCH] sched/fair : fix reordering of enqueue_task_fair Vincent Guittot
2020-03-04 17:50 ` Vincent Guittot
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.