]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] mm: anon is already wrprotected
authorHugh Dickins <hugh@veritas.com>
Sun, 30 Oct 2005 01:15:55 +0000 (18:15 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 30 Oct 2005 04:40:36 +0000 (21:40 -0700)
do_anonymous_page's pte_wrprotect causes some confusion: in such a case,
vm_page_prot must already be forcing COW, so must omit write permission, and
so the pte_wrprotect is redundant.  Replace it by a comment to that effect,
and reword the comment on unuse_pte which also caused confusion.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/memory.c
mm/swapfile.c

index fd5d4c6dc762c83f0a3ce7b808824f38b40db6a2..13667681cd168992f2ea25ca4bb170da7101d136 100644 (file)
@@ -1768,13 +1768,14 @@ do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
                unsigned long addr)
 {
        pte_t entry;
-       struct page * page = ZERO_PAGE(addr);
 
-       /* Read-only mapping of ZERO_PAGE. */
-       entry = pte_wrprotect(mk_pte(ZERO_PAGE(addr), vma->vm_page_prot));
+       /* Mapping of ZERO_PAGE - vm_page_prot is readonly */
+       entry = mk_pte(ZERO_PAGE(addr), vma->vm_page_prot);
 
        /* ..except if it's a write access */
        if (write_access) {
+               struct page *page;
+
                /* Allocate our own private page. */
                pte_unmap(page_table);
                spin_unlock(&mm->page_table_lock);
index 1dcaeda039f4b85f8bbe1b70f4ccbc80de388ade..05c85129124146a3e537f71a145a5fd9da3c4643 100644 (file)
@@ -398,10 +398,9 @@ void free_swap_and_cache(swp_entry_t entry)
 }
 
 /*
- * Always set the resulting pte to be nowrite (the same as COW pages
- * after one process has exited).  We don't know just how many PTEs will
- * share this swap entry, so be cautious and let do_wp_page work out
- * what to do if a write is requested later.
+ * No need to decide whether this PTE shares the swap entry with others,
+ * just let do_wp_page work it out if a write is requested later - to
+ * force COW, vm_page_prot omits write permission from any private vma.
  *
  * vma->vm_mm->page_table_lock is held.
  */