diff options
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 8fb88a906aaa..7c9098d186e6 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -1978,7 +1978,8 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu) | |||
1978 | if (task_hot(p, old_rq->clock, NULL)) | 1978 | if (task_hot(p, old_rq->clock, NULL)) |
1979 | schedstat_inc(p, se.nr_forced2_migrations); | 1979 | schedstat_inc(p, se.nr_forced2_migrations); |
1980 | #endif | 1980 | #endif |
1981 | perf_counter_task_migration(p, new_cpu); | 1981 | perf_swcounter_event(PERF_COUNT_SW_CPU_MIGRATIONS, |
1982 | 1, 1, NULL, 0); | ||
1982 | } | 1983 | } |
1983 | p->se.vruntime -= old_cfsrq->min_vruntime - | 1984 | p->se.vruntime -= old_cfsrq->min_vruntime - |
1984 | new_cfsrq->min_vruntime; | 1985 | new_cfsrq->min_vruntime; |
@@ -7045,7 +7046,7 @@ static int migration_thread(void *data) | |||
7045 | 7046 | ||
7046 | if (cpu_is_offline(cpu)) { | 7047 | if (cpu_is_offline(cpu)) { |
7047 | spin_unlock_irq(&rq->lock); | 7048 | spin_unlock_irq(&rq->lock); |
7048 | goto wait_to_die; | 7049 | break; |
7049 | } | 7050 | } |
7050 | 7051 | ||
7051 | if (rq->active_balance) { | 7052 | if (rq->active_balance) { |
@@ -7071,16 +7072,7 @@ static int migration_thread(void *data) | |||
7071 | complete(&req->done); | 7072 | complete(&req->done); |
7072 | } | 7073 | } |
7073 | __set_current_state(TASK_RUNNING); | 7074 | __set_current_state(TASK_RUNNING); |
7074 | return 0; | ||
7075 | 7075 | ||
7076 | wait_to_die: | ||
7077 | /* Wait for kthread_stop */ | ||
7078 | set_current_state(TASK_INTERRUPTIBLE); | ||
7079 | while (!kthread_should_stop()) { | ||
7080 | schedule(); | ||
7081 | set_current_state(TASK_INTERRUPTIBLE); | ||
7082 | } | ||
7083 | __set_current_state(TASK_RUNNING); | ||
7084 | return 0; | 7076 | return 0; |
7085 | } | 7077 | } |
7086 | 7078 | ||
@@ -7494,6 +7486,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu) | |||
7494 | rq = task_rq_lock(p, &flags); | 7486 | rq = task_rq_lock(p, &flags); |
7495 | __setscheduler(rq, p, SCHED_FIFO, MAX_RT_PRIO-1); | 7487 | __setscheduler(rq, p, SCHED_FIFO, MAX_RT_PRIO-1); |
7496 | task_rq_unlock(rq, &flags); | 7488 | task_rq_unlock(rq, &flags); |
7489 | get_task_struct(p); | ||
7497 | cpu_rq(cpu)->migration_thread = p; | 7490 | cpu_rq(cpu)->migration_thread = p; |
7498 | break; | 7491 | break; |
7499 | 7492 | ||
@@ -7524,6 +7517,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu) | |||
7524 | kthread_bind(cpu_rq(cpu)->migration_thread, | 7517 | kthread_bind(cpu_rq(cpu)->migration_thread, |
7525 | cpumask_any(cpu_online_mask)); | 7518 | cpumask_any(cpu_online_mask)); |
7526 | kthread_stop(cpu_rq(cpu)->migration_thread); | 7519 | kthread_stop(cpu_rq(cpu)->migration_thread); |
7520 | put_task_struct(cpu_rq(cpu)->migration_thread); | ||
7527 | cpu_rq(cpu)->migration_thread = NULL; | 7521 | cpu_rq(cpu)->migration_thread = NULL; |
7528 | break; | 7522 | break; |
7529 | 7523 | ||
@@ -7533,6 +7527,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu) | |||
7533 | migrate_live_tasks(cpu); | 7527 | migrate_live_tasks(cpu); |
7534 | rq = cpu_rq(cpu); | 7528 | rq = cpu_rq(cpu); |
7535 | kthread_stop(rq->migration_thread); | 7529 | kthread_stop(rq->migration_thread); |
7530 | put_task_struct(rq->migration_thread); | ||
7536 | rq->migration_thread = NULL; | 7531 | rq->migration_thread = NULL; |
7537 | /* Idle task back to normal (off runqueue, low prio) */ | 7532 | /* Idle task back to normal (off runqueue, low prio) */ |
7538 | spin_lock_irq(&rq->lock); | 7533 | spin_lock_irq(&rq->lock); |
@@ -7828,7 +7823,7 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd) | |||
7828 | free_rootdomain(old_rd); | 7823 | free_rootdomain(old_rd); |
7829 | } | 7824 | } |
7830 | 7825 | ||
7831 | static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) | 7826 | static int init_rootdomain(struct root_domain *rd, bool bootmem) |
7832 | { | 7827 | { |
7833 | gfp_t gfp = GFP_KERNEL; | 7828 | gfp_t gfp = GFP_KERNEL; |
7834 | 7829 | ||