Skip to content

Commit

Permalink
sched/core: Remove check of p->sched_class
Browse files Browse the repository at this point in the history
Search all usage of p->sched_class in sched/core.c, no one check it
before use, so it seems that every task must belong to one sched_class.

Signed-off-by: Yao Dongdong <yaodongdong@huawei.com>
[ Moved the early class assignment to make it boot. ]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1419835303-28958-1-git-send-email-yaodongdong@huawei.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Yao Dongdong authored and Ingo Molnar committed Jan 14, 2015
1 parent bb04159 commit 1b537c7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -4744,7 +4744,7 @@ static struct rq *move_queued_task(struct task_struct *p, int new_cpu)

void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
{
if (p->sched_class && p->sched_class->set_cpus_allowed)
if (p->sched_class->set_cpus_allowed)
p->sched_class->set_cpus_allowed(p, new_mask);

cpumask_copy(&p->cpus_allowed, new_mask);
Expand Down Expand Up @@ -7253,6 +7253,11 @@ void __init sched_init(void)
atomic_inc(&init_mm.mm_count);
enter_lazy_tlb(&init_mm, current);

/*
* During early bootup we pretend to be a normal task:
*/
current->sched_class = &fair_sched_class;

/*
* Make us the idle thread. Technically, schedule() should not be
* called from this thread, however somewhere below it might be,
Expand All @@ -7263,11 +7268,6 @@ void __init sched_init(void)

calc_load_update = jiffies + LOAD_FREQ;

/*
* During early bootup we pretend to be a normal task:
*/
current->sched_class = &fair_sched_class;

#ifdef CONFIG_SMP
zalloc_cpumask_var(&sched_domains_tmpmask, GFP_NOWAIT);
/* May be allocated at isolcpus cmdline parse time */
Expand Down

0 comments on commit 1b537c7

Please sign in to comment.