aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorDominik Dingel <dingel@linux.vnet.ibm.com>2014-10-23 06:07:44 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2014-10-27 08:27:24 -0400
commit593befa6ab74a805e4f503c8c737c3cffa8066b6 (patch)
treecc8765c8ae5a8b26b0a618a93a6d13b4f73a1b56 /mm
parenta13cff318cafbd493b8d5d679e5f3f761084c4fe (diff)
mm: introduce mm_forbids_zeropage function
Add a new function stub to allow architectures to disable for an mm_structthe backing of non-present, anonymous pages with read-only empty zero pages. Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'mm')
-rw-r--r--mm/huge_memory.c2
-rw-r--r--mm/memory.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 74c78aa8bc2f..7e9c15cb93a9 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -805,7 +805,7 @@ int do_huge_pmd_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
805 return VM_FAULT_OOM; 805 return VM_FAULT_OOM;
806 if (unlikely(khugepaged_enter(vma))) 806 if (unlikely(khugepaged_enter(vma)))
807 return VM_FAULT_OOM; 807 return VM_FAULT_OOM;
808 if (!(flags & FAULT_FLAG_WRITE) && 808 if (!(flags & FAULT_FLAG_WRITE) && !mm_forbids_zeropage(mm) &&
809 transparent_hugepage_use_zero_page()) { 809 transparent_hugepage_use_zero_page()) {
810 spinlock_t *ptl; 810 spinlock_t *ptl;
811 pgtable_t pgtable; 811 pgtable_t pgtable;
diff --git a/mm/memory.c b/mm/memory.c
index 1cc6bfbd872e..d722d4f481c9 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2640,7 +2640,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
2640 return VM_FAULT_SIGBUS; 2640 return VM_FAULT_SIGBUS;
2641 2641
2642 /* Use the zero-page for reads */ 2642 /* Use the zero-page for reads */
2643 if (!(flags & FAULT_FLAG_WRITE)) { 2643 if (!(flags & FAULT_FLAG_WRITE) && !mm_forbids_zeropage(mm)) {
2644 entry = pte_mkspecial(pfn_pte(my_zero_pfn(address), 2644 entry = pte_mkspecial(pfn_pte(my_zero_pfn(address),
2645 vma->vm_page_prot)); 2645 vma->vm_page_prot));
2646 page_table = pte_offset_map_lock(mm, pmd, address, &ptl); 2646 page_table = pte_offset_map_lock(mm, pmd, address, &ptl);