linux-mips
[Top] [All Lists]

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

To: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: [PATCH] MIPS: clear idle task mm pointer when hotplugging cpu
From: maksim.rayskiy@gmail.com
Date: Tue, 8 Feb 2011 16:18:07 -0800
Cc: "Maksim Rayskiy" <mrayskiy@broadcom.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
From: Maksim Rayskiy <mrayskiy@broadcom.com>

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
fork_idle().

Signed-off-by: Maksim Rayskiy <mrayskiy@broadcom.com>
---
 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);
-- 
1.7.3.2



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