diff options
Diffstat (limited to 'arch/i386/mm/highmem.c')
-rw-r--r-- | arch/i386/mm/highmem.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/arch/i386/mm/highmem.c b/arch/i386/mm/highmem.c index f9f647cdbc7b..e0fa6cb655a8 100644 --- a/arch/i386/mm/highmem.c +++ b/arch/i386/mm/highmem.c | |||
@@ -32,7 +32,7 @@ void *kmap_atomic(struct page *page, enum km_type type) | |||
32 | unsigned long vaddr; | 32 | unsigned long vaddr; |
33 | 33 | ||
34 | /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */ | 34 | /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */ |
35 | inc_preempt_count(); | 35 | pagefault_disable(); |
36 | if (!PageHighMem(page)) | 36 | if (!PageHighMem(page)) |
37 | return page_address(page); | 37 | return page_address(page); |
38 | 38 | ||
@@ -50,26 +50,22 @@ void kunmap_atomic(void *kvaddr, enum km_type type) | |||
50 | unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; | 50 | unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; |
51 | enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id(); | 51 | enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id(); |
52 | 52 | ||
53 | #ifdef CONFIG_DEBUG_HIGHMEM | ||
54 | if (vaddr >= PAGE_OFFSET && vaddr < (unsigned long)high_memory) { | ||
55 | dec_preempt_count(); | ||
56 | preempt_check_resched(); | ||
57 | return; | ||
58 | } | ||
59 | |||
60 | if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx)) | ||
61 | BUG(); | ||
62 | #endif | ||
63 | /* | 53 | /* |
64 | * Force other mappings to Oops if they'll try to access this pte | 54 | * Force other mappings to Oops if they'll try to access this pte |
65 | * without first remap it. Keeping stale mappings around is a bad idea | 55 | * without first remap it. Keeping stale mappings around is a bad idea |
66 | * also, in case the page changes cacheability attributes or becomes | 56 | * also, in case the page changes cacheability attributes or becomes |
67 | * a protected page in a hypervisor. | 57 | * a protected page in a hypervisor. |
68 | */ | 58 | */ |
69 | kpte_clear_flush(kmap_pte-idx, vaddr); | 59 | if (vaddr == __fix_to_virt(FIX_KMAP_BEGIN+idx)) |
60 | kpte_clear_flush(kmap_pte-idx, vaddr); | ||
61 | else { | ||
62 | #ifdef CONFIG_DEBUG_HIGHMEM | ||
63 | BUG_ON(vaddr < PAGE_OFFSET); | ||
64 | BUG_ON(vaddr >= (unsigned long)high_memory); | ||
65 | #endif | ||
66 | } | ||
70 | 67 | ||
71 | dec_preempt_count(); | 68 | pagefault_enable(); |
72 | preempt_check_resched(); | ||
73 | } | 69 | } |
74 | 70 | ||
75 | /* This is the same as kmap_atomic() but can map memory that doesn't | 71 | /* This is the same as kmap_atomic() but can map memory that doesn't |
@@ -80,7 +76,7 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type) | |||
80 | enum fixed_addresses idx; | 76 | enum fixed_addresses idx; |
81 | unsigned long vaddr; | 77 | unsigned long vaddr; |
82 | 78 | ||
83 | inc_preempt_count(); | 79 | pagefault_disable(); |
84 | 80 | ||
85 | idx = type + KM_TYPE_NR*smp_processor_id(); | 81 | idx = type + KM_TYPE_NR*smp_processor_id(); |
86 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); | 82 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); |