Messages in this thread Patch in this message | | | Date | Sun, 25 Sep 2005 16:51:03 +0100 (BST) | From | Hugh Dickins <> | Subject | [PATCH 05/21] mm: anon is already wrprotected |
| |
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> ---
mm/memory.c | 7 ++++--- mm/swapfile.c | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-)
--- mm04/mm/memory.c 2005-09-24 19:27:05.000000000 +0100 +++ mm05/mm/memory.c 2005-09-24 19:27:19.000000000 +0100 @@ -1768,13 +1768,14 @@ do_anonymous_page(struct mm_struct *mm, 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); --- mm04/mm/swapfile.c 2005-09-22 12:32:04.000000000 +0100 +++ mm05/mm/swapfile.c 2005-09-24 19:27:19.000000000 +0100 @@ -396,10 +396,9 @@ void free_swap_and_cache(swp_entry_t ent } /* - * 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. */ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |