blob: f3caef8396e447882e2a1af6d29d79952863da8e [file] [log] [blame]
From c2dd6ba895528e08d5c82dcbcabaac47ae9d5fc9 Mon Sep 17 00:00:00 2001
From: Thomas Gleixner <tglx@linutronix.de>
Date: Fri, 24 Jul 2009 15:23:27 +0200
Subject: [PATCH] mips: Prepare decoupling page-fault logic from preempt-count
commit 6408db29f29fe5a2f6d385a9957b113ac766a921 in tip.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index e97a7a2..589f1b9 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -75,7 +75,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
* If we're in an interrupt or have no user
* context, we must not take the fault..
*/
- if (in_atomic() || !mm)
+ if (in_atomic() || !mm || current->pagefault_disabled)
goto bad_area_nosemaphore;
down_read(&mm->mmap_sem);
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index 127d732..384159b 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -46,7 +46,7 @@ void *__kmap_atomic(struct page *page, enum km_type type)
enum fixed_addresses idx;
unsigned long vaddr;
- /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
+ preempt_disable();
pagefault_disable();
if (!PageHighMem(page))
return page_address(page);
@@ -72,6 +72,7 @@ void __kunmap_atomic(void *kvaddr, enum km_type type)
if (vaddr < FIXADDR_START) { // FIXME
pagefault_enable();
+ preempt_enable();
return;
}
@@ -86,6 +87,7 @@ void __kunmap_atomic(void *kvaddr, enum km_type type)
#endif
pagefault_enable();
+ preempt_enable();
}
EXPORT_SYMBOL(__kunmap_atomic);
@@ -98,6 +100,7 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
enum fixed_addresses idx;
unsigned long vaddr;
+ preempt_disable();
pagefault_disable();
debug_kmap_atomic(type);
--
1.7.1.1