[PATCH mm] page fault patches: fix highpte in do_anon_page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix "scheduling while atomic" messages below do_anonymous_page when
CONFIG_HIGHPTE=y: must unmap and remap the page_table around page
allocation.  And let's shift the usual pte_unmap to the minor_fault exit.

Signed-off-by: Hugh Dickins <[email protected]>
---

Please don't interpret this fix as my approving the do_anonymous_page
without page_table_lock patches!  I'm still averse to this special
route with different locking rules; but let's get it right for testing.

 mm/memory.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

--- 2.6.13-rc3-mm3/mm/memory.c	2005-07-29 14:11:33.000000000 +0100
+++ linux/mm/memory.c	2005-07-29 20:58:54.000000000 +0100
@@ -1796,12 +1796,12 @@ do_anonymous_page(struct mm_struct *mm, 
 		} else {
 			inc_page_state(cmpxchg_fail_anon_read);
 		}
-		pte_unmap(page_table);
 		goto minor_fault;
 	}
 
 	/* This leaves the write case */
 	page_table_atomic_stop(mm);
+	pte_unmap(page_table);
 	if (unlikely(anon_vma_prepare(vma)))
 		goto oom;
 
@@ -1812,10 +1812,10 @@ do_anonymous_page(struct mm_struct *mm, 
 	entry = maybe_mkwrite(pte_mkdirty(mk_pte(page,
 						vma->vm_page_prot)),
 				vma);
+	page_table = pte_offset_map(pmd, addr);
 	page_table_atomic_start(mm);
 
 	if (!ptep_cmpxchg(mm, addr, page_table, orig_entry, entry)) {
-		pte_unmap(page_table);
 		page_cache_release(page);
 		inc_page_state(cmpxchg_fail_anon_write);
 		goto minor_fault;
@@ -1829,12 +1829,12 @@ do_anonymous_page(struct mm_struct *mm, 
 	page_add_anon_rmap(page, vma, addr);
 	lru_cache_add_active(page);
 	inc_mm_counter(mm, rss);
-	pte_unmap(page_table);
 	update_mmu_cache(vma, addr, entry);
 	lazy_mmu_prot_update(entry);
 
 minor_fault:
 	page_table_atomic_stop(mm);
+	pte_unmap(page_table);
 	return VM_FAULT_MINOR;
 
 oom:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux