[PATCH 4/6] ksm: change the prot handling to use the generic helper functions

From: Izik Eidus
Date: Mon May 04 2009 - 18:28:44 EST


This is needed to avoid breaking some architectures.

Signed-off-by: Izik Eidus <ieidus@xxxxxxxxxx>
---
mm/ksm.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index 6e8b24b..8a0489b 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -762,8 +762,8 @@ static int try_to_merge_two_pages_alloc(struct mm_struct *mm1,
up_read(&mm1->mmap_sem);
return ret;
}
- prot = vma->vm_page_prot;
- pgprot_val(prot) &= ~_PAGE_RW;
+
+ prot = vm_get_page_prot(vma->vm_flags & ~VM_WRITE);

copy_user_highpage(kpage, page1, addr1, vma);
ret = try_to_merge_one_page(mm1, vma, page1, kpage, prot);
@@ -780,8 +780,7 @@ static int try_to_merge_two_pages_alloc(struct mm_struct *mm1,
return ret;
}

- prot = vma->vm_page_prot;
- pgprot_val(prot) &= ~_PAGE_RW;
+ prot = vm_get_page_prot(vma->vm_flags & ~VM_WRITE);

ret = try_to_merge_one_page(mm2, vma, page2, kpage,
prot);
@@ -827,8 +826,9 @@ static int try_to_merge_two_pages_noalloc(struct mm_struct *mm1,
up_read(&mm1->mmap_sem);
return ret;
}
- prot = vma->vm_page_prot;
- pgprot_val(prot) &= ~_PAGE_RW;
+
+ prot = vm_get_page_prot(vma->vm_flags & ~VM_WRITE);
+
ret = try_to_merge_one_page(mm1, vma, page1, page2, prot);
up_read(&mm1->mmap_sem);
if (!ret)
--
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/