diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2013-09-12 18:14:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-12 18:38:03 -0400 |
commit | c02925540ca7019465a43c00f8a3c0186ddace2b (patch) | |
tree | 3097ece86eedd0a01cf5dbc0a8f6c28fcbd1f4f7 /mm/memory.c | |
parent | 128ec037bafe5905b2e6f2796f426a1d247d0066 (diff) |
thp: consolidate code between handle_mm_fault() and do_huge_pmd_anonymous_page()
do_huge_pmd_anonymous_page() has copy-pasted piece of handle_mm_fault()
to handle fallback path.
Let's consolidate code back by introducing VM_FAULT_FALLBACK return
code.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Hillf Danton <dhillf@gmail.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Hugh Dickins <hughd@google.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Dave Hansen <dave.hansen@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.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mm/memory.c b/mm/memory.c index 5ec6f199e685..ca0003947115 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -3695,7 +3695,7 @@ static int do_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3695 | * but allow concurrent faults), and pte mapped but not yet locked. | 3695 | * but allow concurrent faults), and pte mapped but not yet locked. |
3696 | * We return with mmap_sem still held, but pte unmapped and unlocked. | 3696 | * We return with mmap_sem still held, but pte unmapped and unlocked. |
3697 | */ | 3697 | */ |
3698 | int handle_pte_fault(struct mm_struct *mm, | 3698 | static int handle_pte_fault(struct mm_struct *mm, |
3699 | struct vm_area_struct *vma, unsigned long address, | 3699 | struct vm_area_struct *vma, unsigned long address, |
3700 | pte_t *pte, pmd_t *pmd, unsigned int flags) | 3700 | pte_t *pte, pmd_t *pmd, unsigned int flags) |
3701 | { | 3701 | { |
@@ -3774,9 +3774,12 @@ retry: | |||
3774 | if (!pmd) | 3774 | if (!pmd) |
3775 | return VM_FAULT_OOM; | 3775 | return VM_FAULT_OOM; |
3776 | if (pmd_none(*pmd) && transparent_hugepage_enabled(vma)) { | 3776 | if (pmd_none(*pmd) && transparent_hugepage_enabled(vma)) { |
3777 | int ret = VM_FAULT_FALLBACK; | ||
3777 | if (!vma->vm_ops) | 3778 | if (!vma->vm_ops) |
3778 | return do_huge_pmd_anonymous_page(mm, vma, address, | 3779 | ret = do_huge_pmd_anonymous_page(mm, vma, address, |
3779 | pmd, flags); | 3780 | pmd, flags); |
3781 | if (!(ret & VM_FAULT_FALLBACK)) | ||
3782 | return ret; | ||
3780 | } else { | 3783 | } else { |
3781 | pmd_t orig_pmd = *pmd; | 3784 | pmd_t orig_pmd = *pmd; |
3782 | int ret; | 3785 | int ret; |