On Tue, Apr 23, 2019 at 04:18:16PM +0000, Vineeth Remanan Pillai wrote:
> +/*
> + * Find left-most (aka, highest priority) task matching @cookie.
> + */
> +struct task_struct *sched_core_find(struct rq *rq, unsigned long cookie)
> +{
> +     struct rb_node *node = rq->core_tree.rb_node;
> +     struct task_struct *node_task, *match;
> +
> +     /*
> +      * The idle task always matches any cookie!
> +      */
> +     match = idle_sched_class.pick_task(rq);
> +
> +     while (node) {
> +             node_task = container_of(node, struct task_struct, core_node);
> +
> +             if (node_task->core_cookie < cookie) {
> +                     node = node->rb_left;

Should go right here?

> +             } else if (node_task->core_cookie > cookie) {
> +                     node = node->rb_right;

And left here?

> +             } else {
> +                     match = node_task;
> +                     node = node->rb_left;
> +             }
> +     }
> +
> +     return match;
> +}

Reply via email to