Re: [PATCH v2] sched/fair: Fix insertion in rq->leaf_cfs_rq_list

From: Vincent Guittot
Date: Wed Jan 30 2019 - 10:49:06 EST


On Wed, 30 Jan 2019 at 14:40, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>

>
> static inline void list_del_leaf_cfs_rq(struct cfs_rq *cfs_rq)
> @@ -352,7 +354,12 @@ static inline void list_del_leaf_cfs_rq(struct cfs_rq *cfs_rq)
> }
> }
>
> -/* Iterate through all leaf cfs_rq's on a runqueue: */
> +static inline void assert_list_leaf_cfs_rq(struct rq *rq)
> +{
> + SCHED_WARN_ON(rq->tmp_alone_branch != &rq->lead_cfs_rq_list);

small typo : s/lead_cfs_rq_list/leaf_cfs_rq_list/

> +}
> +
> +/* Iterate through all cfs_rq's on a runqueue in bottom-up order */
> #define for_each_leaf_cfs_rq(rq, cfs_rq) \
> list_for_each_entry_rcu(cfs_rq, &rq->leaf_cfs_rq_list, leaf_cfs_rq_list)
>
> @@ -446,6 +453,10 @@ static inline void list_del_leaf_cfs_rq(struct cfs_rq *cfs_rq)
> {
> }
>
> +static inline void assert_list_leaf_cfs_rq(struct rq *rq)
> +{
> +}
> +
> #define for_each_leaf_cfs_rq(rq, cfs_rq) \
> for (cfs_rq = &rq->cfs; cfs_rq; cfs_rq = NULL)
>
> @@ -5179,6 +5190,8 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
>
> }
>
> + assert_list_leaf_cfs_rq(rq);
> +
> hrtick_update(rq);
> }
>