scheduler code/doc inconstancy
From: Philip Pratt-Szeliga
Date: Sun Mar 16 2008 - 10:05:07 EST
In Linux 2.6.24.3:
kernel/sched.c line 3663 calls sched_info_switch and line 3665 says
if(likely(prev != next)){
so it looks like this:
sched_info_switch(prev, next);
if (likely(prev != next)) {
But! In kernel/sched_stat.c the following starts at line 206. It says
we are only called when prev != next in the comment but that violates
what is happening above.
/*
* Called when tasks are switched involuntarily due, typically, to expiring
* their time slice. (This may also be called when switching to or from
* the idle task.) ___We are only called when prev != next.___
*/
static inline void
__sched_info_switch(struct task_struct *prev, struct task_struct *next)
{
struct rq *rq = task_rq(prev);
/*
* prev now departs the cpu. It's not interesting to record
* stats about how efficient we were at scheduling the idle
* process, however.
*/
if (prev != rq->idle)
sched_info_depart(prev);
if (next != rq->idle)
sched_info_arrive(next);
}
static inline void
sched_info_switch(struct task_struct *prev, struct task_struct *next)
{
if (unlikely(sched_info_on()))
__sched_info_switch(prev, next);
}
Maybe this is a bug in the code but possibly it is just a problem in
the documentation
Sincerely,
Phil Pratt-Szeliga
--
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/