aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2011-01-13 18:46:37 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 20:32:39 -0500
commit14fd403f2146f740942d78af4e0ee59396ad8eab (patch)
treec87734f6c6639684208d36548aa3687c6f460e23
parent2609ae6d10af0531e826335bd1445d1ace17c847 (diff)
thp: export maybe_mkwrite
huge_memory.c needs it too when it fallbacks in copying hugepages into regular fragmented pages if hugepage allocation fails during COW. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Acked-by: Rik van Riel <riel@redhat.com> Acked-by: Mel Gorman <mel@csn.ul.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/mm.h13
-rw-r--r--mm/memory.c13
2 files changed, 13 insertions, 13 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a2718e1ed585..6bef67d74adf 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -430,6 +430,19 @@ static inline void set_compound_order(struct page *page, unsigned long order)
430} 430}
431 431
432/* 432/*
433 * Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when
434 * servicing faults for write access. In the normal case, do always want
435 * pte_mkwrite. But get_user_pages can cause write faults for mappings
436 * that do not have writing enabled, when used by access_process_vm.
437 */
438static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
439{
440 if (likely(vma->vm_flags & VM_WRITE))
441 pte = pte_mkwrite(pte);
442 return pte;
443}
444
445/*
433 * Multiple processes may "see" the same page. E.g. for untouched 446 * Multiple processes may "see" the same page. E.g. for untouched
434 * mappings of /dev/null, all processes see the same page full of 447 * mappings of /dev/null, all processes see the same page full of
435 * zeroes, and text pages of executables and shared libraries have 448 * zeroes, and text pages of executables and shared libraries have
diff --git a/mm/memory.c b/mm/memory.c
index 1bbe9a22429c..bdf19366b705 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2083,19 +2083,6 @@ static inline int pte_unmap_same(struct mm_struct *mm, pmd_t *pmd,
2083 return same; 2083 return same;
2084} 2084}
2085 2085
2086/*
2087 * Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when
2088 * servicing faults for write access. In the normal case, do always want
2089 * pte_mkwrite. But get_user_pages can cause write faults for mappings
2090 * that do not have writing enabled, when used by access_process_vm.
2091 */
2092static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
2093{
2094 if (likely(vma->vm_flags & VM_WRITE))
2095 pte = pte_mkwrite(pte);
2096 return pte;
2097}
2098
2099static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va, struct vm_area_struct *vma) 2086static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va, struct vm_area_struct *vma)
2100{ 2087{
2101 /* 2088 /*