linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 8/4  -ac to newer rmap
@ 2002-11-13 14:50 Rik van Riel
  0 siblings, 0 replies; only message in thread
From: Rik van Riel @ 2002-11-13 14:50 UTC (permalink / raw)
  To: Alan Cox; +Cc: Arjan van de Ven, linux-mm

Patch by Paul Mackarras to make sure that remap_pmd_range calls
pte_alloc with the full address, so we don't have pagetables with
wrong pte->mm and pte->index

(ObWork: my patches are sponsored by Conectiva, Inc)
--- linux-2.4.19/mm/memory.c	2002-11-13 08:48:31.000000000 -0200
+++ linux-2.4-rmap/mm/memory.c	2002-11-13 12:10:45.000000000 -0200
@@ -164,6 +164,7 @@ int check_pgt_cache(void)
 void clear_page_tables(struct mm_struct *mm, unsigned long first, int nr)
 {
 	pgd_t * page_dir = mm->pgd;
+	unsigned long	last = first + nr;
 
 	spin_lock(&mm->page_table_lock);
 	page_dir += first;
@@ -173,6 +175,8 @@ void clear_page_tables(struct mm_struct 
 	} while (--nr);
 	spin_unlock(&mm->page_table_lock);
 
+	flush_tlb_pgtables(mm, first * PGDIR_SIZE, last * PGDIR_SIZE);
+	
 	/* keep the page table cache within bounds */
 	check_pgt_cache();
 }
@@ -886,18 +889,19 @@ static inline void remap_pte_range(pte_t
 static inline int remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size,
 	unsigned long phys_addr, pgprot_t prot)
 {
-	unsigned long end;
+	unsigned long base, end;
 
+	base = address & PGDIR_MASK;
 	address &= ~PGDIR_MASK;
 	end = address + size;
 	if (end > PGDIR_SIZE)
 		end = PGDIR_SIZE;
 	phys_addr -= address;
 	do {
-		pte_t * pte = pte_alloc(mm, pmd, address);
+		pte_t * pte = pte_alloc(mm, pmd, address + base);
 		if (!pte)
 			return -ENOMEM;
-		remap_pte_range(pte, address, end - address, address + phys_addr, prot);
+		remap_pte_range(pte, base + address, end - address, address + phys_addr, prot);
 		address = (address + PMD_SIZE) & PMD_MASK;
 		pmd++;
 	} while (address && (address < end));
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

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

only message in thread, other threads:[~2002-11-13 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-13 14:50 [PATCH] 8/4 -ac to newer rmap Rik van Riel

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