Re: [RFC][PATCH 05/22] sched: SCHED_DEADLINE policy implementation
From: Peter Zijlstra
Date: Thu Nov 11 2010 - 09:17:23 EST
On Fri, 2010-10-29 at 08:30 +0200, Raistlin wrote:
> +static void update_curr_dl(struct rq *rq)
> +{
> + struct task_struct *curr = rq->curr;
> + struct sched_dl_entity *dl_se = &curr->dl;
> + u64 delta_exec;
> +
> + if (!dl_task(curr) || !on_dl_rq(dl_se))
> + return;
> +
> + delta_exec = rq->clock - curr->se.exec_start;
> + if (unlikely((s64)delta_exec < 0))
> + delta_exec = 0;
> +
> + schedstat_set(curr->se.statistics.exec_max,
> + max(curr->se.statistics.exec_max, delta_exec));
> +
> + curr->se.sum_exec_runtime += delta_exec;
> + account_group_exec_runtime(curr, delta_exec);
> +
> + curr->se.exec_start = rq->clock;
> + cpuacct_charge(curr, delta_exec);
> +
> + dl_se->runtime -= delta_exec;
> + if (dl_runtime_exceeded(rq, dl_se)) {
> + __dequeue_task_dl(rq, curr, 0);
> + if (likely(start_dl_timer(dl_se)))
> + dl_se->dl_throttled = 1;
> + else
> + enqueue_task_dl(rq, curr, ENQUEUE_REPLENISH);
> +
> + resched_task(curr);
> + }
> +}
So you keep the current task in the rb-tree? If you remove the current
task from the tree you don't have to do the whole dequeue/enqueue thing.
Then again, I guess it only really matters once you push the deadline,
which shouldn't be that often.
Also, you might want to put a conditional around that resched, no point
rescheduling if you're still the leftmost task.
--
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/