Skip to contentSkip to conversation

linux/kernel/sched.c: context_switch().

DISCUSSION fabio de francesco 1 participant 1 message Sep 8, 2010

lore
Share & tools
lore
#0 lore raw

There must be something I am missing in sched.c at context_switch() function definition.

There I can read the following code:

static inline void
context_switch(struct rq *rq, struct task_struct *prev,
struct task_struct *next)

{
	...
	struct mm_struct *mm;
	mm = next->mm;
	if (likely(!mm)) {
                next->active_mm = oldmm;
                atomic_inc(&oldmm->mm_count);
                enter_lazy_tlb(oldmm, next);
        } else
                switch_mm(oldmm, mm, next);
	...
}

May someone please explain why the mm pointer is likely supposed to be NULL?

Thanks in advance.

fabio