patch-1.3.47 linux/mm/memory.c

Next file: linux/mm/mprotect.c
Previous file: linux/mm/filemap.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.46/linux/mm/memory.c linux/mm/memory.c
@@ -134,7 +134,7 @@
 	}
 	for (i = 0 ; i < USER_PTRS_PER_PGD ; i++)
 		free_one_pgd(page_dir + i);
-	invalidate();
+	invalidate_mm(tsk->mm);
 }
 
 /*
@@ -153,12 +153,12 @@
 		printk("%s trying to free kernel page-directory: not good\n", tsk->comm);
 		return;
 	}
+	invalidate_mm(tsk->mm);
 	SET_PAGE_DIR(tsk, swapper_pg_dir);
 	tsk->mm->pgd = swapper_pg_dir;	/* or else... */
 	for (i = 0 ; i < PTRS_PER_PGD ; i++)
 		free_one_pgd(page_dir + i);
 	pgd_free(page_dir);
-	invalidate();
 }
 
 int new_page_tables(struct task_struct * tsk)
@@ -171,6 +171,7 @@
 	page_dir = pgd_offset(&init_mm, 0);
 	for (i = USER_PTRS_PER_PGD ; i < PTRS_PER_PGD ; i++)
 		new_pg[i] = page_dir[i];
+	invalidate_mm(tsk->mm);
 	SET_PAGE_DIR(tsk, new_pg);
 	tsk->mm->pgd = new_pg;
 	return 0;
@@ -285,7 +286,9 @@
 			break;
 		address = (address + PGDIR_SIZE) & PGDIR_MASK;
 	}
-	invalidate();
+	/* Note that the src ptes get c-o-w treatment, so they change too. */
+	invalidate_range(src, vma->vm_start, vma->vm_end);
+	invalidate_range(dst, vma->vm_start, vma->vm_end);
 	return error;
 }
 
@@ -369,7 +372,7 @@
 		address = (address + PGDIR_SIZE) & PGDIR_MASK;
 		dir++;
 	}
-	invalidate();
+	invalidate_range(mm, end - size, end);
 	return 0;
 }
 
@@ -429,7 +432,7 @@
 		address = (address + PGDIR_SIZE) & PGDIR_MASK;
 		dir++;
 	}
-	invalidate();
+	invalidate_range(current->mm, end - size, end);
 	return error;
 }
 
@@ -499,7 +502,7 @@
 		from = (from + PGDIR_SIZE) & PGDIR_MASK;
 		dir++;
 	}
-	invalidate();
+	invalidate_range(current->mm, from - size, from);
 	return error;
 }
 
@@ -514,7 +517,7 @@
 		return;
 	}
 /* no need for invalidate */
-	*page_table = pte;
+	set_pte(page_table, pte);
 }
 
 /*
@@ -547,7 +550,7 @@
 	if (!pte_none(*pte)) {
 		printk("put_dirty_page: page already exists\n");
 		pte_clear(pte);
-		invalidate();
+		invalidate_page(tsk->mm, address);
 	}
 	set_pte(pte, pte_mkwrite(pte_mkdirty(mk_pte(page, PAGE_COPY))));
 /* no need for invalidate */
@@ -610,17 +613,17 @@
 			copy_page(old_page,new_page);
 			set_pte(page_table, pte_mkwrite(pte_mkdirty(mk_pte(new_page, vma->vm_page_prot))));
 			free_page(old_page);
-			invalidate();
+			invalidate_page(vma->vm_mm, address);
 			return;
 		}
 		set_pte(page_table, BAD_PAGE);
 		free_page(old_page);
 		oom(tsk);
-		invalidate();
+		invalidate_page(vma->vm_mm, address);
 		return;
 	}
 	set_pte(page_table, pte_mkdirty(pte_mkwrite(pte)));
-	invalidate();
+	invalidate_page(vma->vm_mm, address);
 	if (new_page)
 		free_page(new_page);
 	return;
@@ -842,7 +845,7 @@
 		return 1;
 /* ok, need to mark it read-only, so invalidate any possible old TB entry */
 	set_pte(from_table, pte_wrprotect(from));
-	invalidate();
+	invalidate_page(from_area->vm_mm, from_address);
 	return 1;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this