summaryrefslogtreecommitdiff
path: root/kernel/sched
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-06-06 10:20:33 (GMT)
committerScott Wood <scottwood@freescale.com>2015-02-13 22:20:32 (GMT)
commita2dc3dc8baee709966e36929b6fbd1cb141cdc0a (patch)
tree2b8fb288ca53ac67e0c67b55afb50d0a3ad1e791 /kernel/sched
parent7cb4692689e70d12daa08b31634f29107020d0a1 (diff)
downloadlinux-fsl-qoriq-a2dc3dc8baee709966e36929b6fbd1cb141cdc0a.tar.xz
sched-mmdrop-delayed.patch
Needs thread context (pgd_lock) -> ifdeffed. workqueues wont work with RT Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/core.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f382e71..e45a599 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1905,8 +1905,12 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev)
finish_arch_post_lock_switch();
fire_sched_in_preempt_notifiers(current);
+ /*
+ * We use mmdrop_delayed() here so we don't have to do the
+ * full __mmdrop() when we are the last user.
+ */
if (mm)
- mmdrop(mm);
+ mmdrop_delayed(mm);
if (unlikely(prev_state == TASK_DEAD)) {
/*
* Remove function-return probe instances associated with this
@@ -4437,6 +4441,8 @@ static int migration_cpu_stop(void *data)
#ifdef CONFIG_HOTPLUG_CPU
+static DEFINE_PER_CPU(struct mm_struct *, idle_last_mm);
+
/*
* Ensures that the idle task is using init_mm right before its cpu goes
* offline.
@@ -4449,7 +4455,12 @@ void idle_task_exit(void)
if (mm != &init_mm)
switch_mm(mm, &init_mm, current);
- mmdrop(mm);
+
+ /*
+ * Defer the cleanup to an alive cpu. On RT we can neither
+ * call mmdrop() nor mmdrop_delayed() from here.
+ */
+ per_cpu(idle_last_mm, smp_processor_id()) = mm;
}
/*
@@ -4773,6 +4784,10 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
case CPU_DEAD:
calc_load_migrate(rq);
+ if (per_cpu(idle_last_mm, cpu)) {
+ mmdrop(per_cpu(idle_last_mm, cpu));
+ per_cpu(idle_last_mm, cpu) = NULL;
+ }
break;
#endif
}