Commit 17095c07 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Check for preemption in kunmap_atomic()

From: Joe Korty <joe.korty@ccur.com>

We need to check whether preemption is needed after reenabling preemption
in kunmap_atomic().
parent 655da9eb
......@@ -30,6 +30,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 */
inc_preempt_count();
if (page < highmem_start_page)
return page_address(page);
......@@ -54,6 +55,7 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
if (vaddr < FIXADDR_START) { // FIXME
dec_preempt_count();
preempt_check_resched();
return;
}
......@@ -69,6 +71,7 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
#endif
dec_preempt_count();
preempt_check_resched();
}
struct page *kmap_atomic_to_page(void *ptr)
......
......@@ -40,6 +40,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 */
inc_preempt_count();
if (page < highmem_start_page)
return page_address(page);
......@@ -64,6 +65,7 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
if (vaddr < FIXADDR_START) { // FIXME
dec_preempt_count();
preempt_check_resched();
return;
}
......@@ -79,6 +81,7 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
#endif
dec_preempt_count();
preempt_check_resched();
}
struct page *kmap_atomic_to_page(void *ptr)
......
......@@ -33,6 +33,7 @@ void *kmap_atomic(struct page *page, enum km_type type)
unsigned long idx;
unsigned long vaddr;
/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
inc_preempt_count();
if (page < highmem_start_page)
return page_address(page);
......@@ -69,6 +70,7 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
if (vaddr < fix_kmap_begin) { // FIXME
dec_preempt_count();
preempt_check_resched();
return;
}
......@@ -96,4 +98,5 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
#endif
#endif
dec_preempt_count();
preempt_check_resched();
}
......@@ -81,6 +81,7 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
unsigned int idx;
unsigned long vaddr;
/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
inc_preempt_count();
if (page < highmem_start_page)
return page_address(page);
......@@ -105,6 +106,7 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
if (vaddr < KMAP_FIX_BEGIN) { // FIXME
dec_preempt_count();
preempt_check_resched();
return;
}
......@@ -119,6 +121,7 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
flush_tlb_page(0, vaddr);
#endif
dec_preempt_count();
preempt_check_resched();
}
static inline struct page *kmap_atomic_to_page(void *ptr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment