Messages in this thread | | | Date | Mon, 29 Apr 2019 14:15:18 +0800 | From | Aaron Lu <> | Subject | Re: [RFC PATCH v2 11/17] sched: Basic tracking of matching tasks |
| |
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; > +}
| |