aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mm/memory.c
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2016-07-26 15:25:40 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2016-07-26 16:19:19 -0700
commitaf9e4d5f2de2eabdc7145e077ba48b2a638465c6 (patch)
tree9ac84a9f70046c63d080f99f03bb115745859d9d /mm/memory.c
parentthp: handle file pages in split_huge_pmd() (diff)
downloadwireguard-linux-af9e4d5f2de2eabdc7145e077ba48b2a638465c6.tar.xz
wireguard-linux-af9e4d5f2de2eabdc7145e077ba48b2a638465c6.zip
thp: handle file COW faults
File COW for THP is handled on pte level: just split the pmd. It's not clear how benefitial would be allocation of huge pages on COW faults. And it would require some code to make them work. I think at some point we can consider teaching khugepaged to collapse pages in COW mappings, but allocating huge on fault is probably overkill. Link: http://lkml.kernel.org/r/1466021202-61880-16-git-send-email-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 10a424eca8a4..8f4254798130 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3446,6 +3446,11 @@ static int wp_huge_pmd(struct fault_env *fe, pmd_t orig_pmd)
if (fe->vma->vm_ops->pmd_fault)
return fe->vma->vm_ops->pmd_fault(fe->vma, fe->address, fe->pmd,
fe->flags);
+
+ /* COW handled on pte level: split pmd */
+ VM_BUG_ON_VMA(fe->vma->vm_flags & VM_SHARED, fe->vma);
+ split_huge_pmd(fe->vma, fe->pmd, fe->address);
+
return VM_FAULT_FALLBACK;
}