Commit 80d7ef66 authored by Kirill A. Shutemov's avatar Kirill A. Shutemov Committed by Linus Torvalds

mm: rename __do_fault() -> do_fault()

Current __do_fault() is awful and unmaintainable.  These patches try to
sort it out by split __do_fault() into three destinct codepaths:

 - to handle read page fault;
 - to handle write page fault to private mappings;
 - to handle write page fault to shared mappings;

I also found page refcount leak in PageHWPoison() path of __do_fault().

This patch (of 7):

do_fault() is unused: no reason for underscores.
Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c558784f
...@@ -2748,7 +2748,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, ...@@ -2748,7 +2748,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
* bit after it clear all dirty ptes, but before a racing * bit after it clear all dirty ptes, but before a racing
* do_wp_page installs a dirty pte. * do_wp_page installs a dirty pte.
* *
* __do_fault is protected similarly. * do_fault is protected similarly.
*/ */
if (!page_mkwrite) { if (!page_mkwrite) {
wait_on_page_locked(dirty_page); wait_on_page_locked(dirty_page);
...@@ -3287,7 +3287,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, ...@@ -3287,7 +3287,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
} }
/* /*
* __do_fault() tries to create a new page mapping. It aggressively * do_fault() tries to create a new page mapping. It aggressively
* tries to share with existing pages, but makes a separate copy if * tries to share with existing pages, but makes a separate copy if
* the FAULT_FLAG_WRITE is set in the flags parameter in order to avoid * the FAULT_FLAG_WRITE is set in the flags parameter in order to avoid
* the next page fault. * the next page fault.
...@@ -3299,7 +3299,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, ...@@ -3299,7 +3299,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
* but allow concurrent faults), and pte neither mapped nor locked. * but allow concurrent faults), and pte neither mapped nor locked.
* We return with mmap_sem still held, but pte unmapped and unlocked. * We return with mmap_sem still held, but pte unmapped and unlocked.
*/ */
static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma, static int do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
unsigned long address, pmd_t *pmd, unsigned long address, pmd_t *pmd,
pgoff_t pgoff, unsigned int flags, pte_t orig_pte) pgoff_t pgoff, unsigned int flags, pte_t orig_pte)
{ {
...@@ -3496,7 +3496,7 @@ static int do_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma, ...@@ -3496,7 +3496,7 @@ static int do_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma,
- vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
pte_unmap(page_table); pte_unmap(page_table);
return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); return do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte);
} }
/* /*
...@@ -3528,7 +3528,7 @@ static int do_nonlinear_fault(struct mm_struct *mm, struct vm_area_struct *vma, ...@@ -3528,7 +3528,7 @@ static int do_nonlinear_fault(struct mm_struct *mm, struct vm_area_struct *vma,
} }
pgoff = pte_to_pgoff(orig_pte); pgoff = pte_to_pgoff(orig_pte);
return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); return do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte);
} }
static int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, static int numa_migrate_prep(struct page *page, struct vm_area_struct *vma,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment