[Top] [All Lists]

[PATCH] MIPS: clear idle task mm pointer when hotplugging cpu

Subject: [PATCH] MIPS: clear idle task mm pointer when hotplugging cpu
Date: Tue, 8 Feb 2011 16:18:07 -0800
Cc: "Maksim Rayskiy" <>
Original-recipient: rfc822;
From: Maksim Rayskiy <>

If kernel starts with maxcpus= option which does not bring all
available cpus online at boot time, idle tasks for offline cpus
are not created. If later offline cpus are hotplugged through sysfs,
__cpu_up is called in the context of the user task, and fork_idle
copies its non-zero mm pointer.  This causes BUG() in per_cpu_trap_init.

To avoid this, release mm for idle task and reset the pointer after

Signed-off-by: Maksim Rayskiy <>
 arch/mips/kernel/smp.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 383aeb9..4593916 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -208,6 +208,11 @@ int __cpuinit __cpu_up(unsigned int cpu)
                if (IS_ERR(idle))
                        panic(KERN_ERR "Fork failed for CPU %d", cpu);
+               if (idle->mm) {
+                       mmput(idle->mm);
+                       idle->mm = NULL;
+               }
        } else {
                idle = cpu_idle_thread[cpu];
                init_idle(idle, cpu);

<Prev in Thread] Current Thread [Next in Thread>