mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH mm] page fault patches: fix highpte in do_anon_page
@ 2005-07-30 20:07 Hugh Dickins
  0 siblings, 0 replies; only message in thread
From: Hugh Dickins @ 2005-07-30 20:07 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Christoph Lameter, linux-kernel

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 <hugh@veritas.com>
---

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:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-07-30 20:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-30 20:07 [PATCH mm] page fault patches: fix highpte in do_anon_page Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®