Re: [patch] CFS scheduler, -v15
From: Srivatsa Vaddagiri
Date: Thu Jun 14 2007 - 08:35:08 EST
On Wed, Jun 06, 2007 at 05:07:33PM +0530, Srivatsa Vaddagiri wrote:
> > I don't think that rt_sched_class :: dequeue_task_rt() is in any of
> > such "fast pathes" that we should really care about an additional
> > math. operation.
> >
> > If this approach is ok, logically-wise (no side effects from a short
> > 'delta_exec', esp. on RT -> NORMAL).. I think it's better as it keeps
> > the 'sched_class' interface simpler.
>
> I can see your point, given that we just update exec_start in
> dequeue_task_rt(). However the situation is slightly more complex in my
> patch stack, as I need to update other things during group change. Perhaps
> we can postpone this discussion until I post that patch stack.
Now that I have posted the group scheduling patch stack, we can come
back to this point.
Basically I am maintaining a ->curr field in 'struct lrq' (when
CONFIG_FAIR_GROUP_SCHED is on). It is NULL if the lrq is "inactive" [ none of
its entities are currently running ], otherwise it points to the currentive
active entity. This helps me optimize some functions like update_curr() - when
lrq->curr is NULL, we don't have to update fair_clock etc upon enqueue/dequeue
to the lrq.
pick_next_entity() sets lrq->curr while put_prev_entity resets lrq->curr
to NULL.
Also these lrqs could form a hierarchy. At the top could be a lrq which
holds user-level sched entities on each cpu. Next, each user's lrq could
hold task-level entities.
So when a task moves from RT class to NORMAL class, it will get added to
one of the lrqs (say root user's lrq on CPU0). At that time, I need to:
root_user_lrq[cpu0]->curr = &task_moving->se;
top_lrq[cpu0]->curr = &root_user->se;
I have added a special callback set_curr_task() in fair_sched_class to
accomplish this.
Similarly when a task moves from NORMAL class to RT class, I need to:
root_user_cpu0_lrq->curr = NULL;
top_lrq_cpu0->curr = NULL;
For this I am reusing the put_prev_task() callback.
I have to accomplish the same steps when a task moves from one group to
other also.
Let me know what you think about set_curr_task() callback [in Patch #6]. The
other option was to tackle this requirement in enqueue/dequeue_task (if
current task is being enqueue/dequeued then set/reset lrq->curr), which I felt
add unnecessary overhead in normal path (a current task for ex gets
dequeued when it goes to sleep).
--
Regards,
vatsa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/