Re: [PATCH 04/21] sched: implement scheduler notifiers

From: Peter Zijlstra
Date: Mon Nov 16 2009 - 13:41:05 EST


On Tue, 2009-11-17 at 02:15 +0900, Tejun Heo wrote:
> @@ -1939,6 +1953,8 @@ static int effective_prio(struct task_struct *p)
> */
> static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
> {
> + sched_notifier_call(p, SCHED_NOTIFIER_ACTIVATED, activated, wakeup);
> +
> if (task_contributes_to_load(p))
> rq->nr_uninterruptible--;
>
> @@ -1951,6 +1967,8 @@ static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
> */
> static void deactivate_task(struct rq *rq, struct task_struct *p, int sleep)
> {
> + sched_notifier_call(p, SCHED_NOTIFIER_DEACTIVATED, deactivated, sleep);
> +
> if (task_contributes_to_load(p))
> rq->nr_uninterruptible++;
>

I really hate exposing activate/deactivate.

You say:

> Activated and deactivated are called
> when a task's readiness to run changes.

How is that not clear from the out hook? It would seem to me that when
you get scheduled out with a p->state != TASK_RUNNING you're not ready.
--
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/