diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2014-04-03 17:48:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 19:21:03 -0400 |
commit | 80d7ef66142b0b4358223790e7a4cb153b48a05c (patch) | |
tree | 015aa1bba559be299fe895da2d1df4f83919144c /mm/memory.c | |
parent | c558784fa9e65363ed32cf6ff137c89bc8b54f81 (diff) |
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: Kirill 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: 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 | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mm/memory.c b/mm/memory.c index 57ff3510ddbd..144e8cd07805 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -2748,7 +2748,7 @@ reuse: | |||
2748 | * bit after it clear all dirty ptes, but before a racing | 2748 | * bit after it clear all dirty ptes, but before a racing |
2749 | * do_wp_page installs a dirty pte. | 2749 | * do_wp_page installs a dirty pte. |
2750 | * | 2750 | * |
2751 | * __do_fault is protected similarly. | 2751 | * do_fault is protected similarly. |
2752 | */ | 2752 | */ |
2753 | if (!page_mkwrite) { | 2753 | if (!page_mkwrite) { |
2754 | wait_on_page_locked(dirty_page); | 2754 | wait_on_page_locked(dirty_page); |
@@ -3287,7 +3287,7 @@ oom: | |||
3287 | } | 3287 | } |
3288 | 3288 | ||
3289 | /* | 3289 | /* |
3290 | * __do_fault() tries to create a new page mapping. It aggressively | 3290 | * do_fault() tries to create a new page mapping. It aggressively |
3291 | * tries to share with existing pages, but makes a separate copy if | 3291 | * tries to share with existing pages, but makes a separate copy if |
3292 | * the FAULT_FLAG_WRITE is set in the flags parameter in order to avoid | 3292 | * the FAULT_FLAG_WRITE is set in the flags parameter in order to avoid |
3293 | * the next page fault. | 3293 | * the next page fault. |
@@ -3299,7 +3299,7 @@ oom: | |||
3299 | * but allow concurrent faults), and pte neither mapped nor locked. | 3299 | * but allow concurrent faults), and pte neither mapped nor locked. |
3300 | * We return with mmap_sem still held, but pte unmapped and unlocked. | 3300 | * We return with mmap_sem still held, but pte unmapped and unlocked. |
3301 | */ | 3301 | */ |
3302 | static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma, | 3302 | static int do_fault(struct mm_struct *mm, struct vm_area_struct *vma, |
3303 | unsigned long address, pmd_t *pmd, | 3303 | unsigned long address, pmd_t *pmd, |
3304 | pgoff_t pgoff, unsigned int flags, pte_t orig_pte) | 3304 | pgoff_t pgoff, unsigned int flags, pte_t orig_pte) |
3305 | { | 3305 | { |
@@ -3496,7 +3496,7 @@ static int do_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3496 | - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; | 3496 | - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; |
3497 | 3497 | ||
3498 | pte_unmap(page_table); | 3498 | pte_unmap(page_table); |
3499 | return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); | 3499 | return do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); |
3500 | } | 3500 | } |
3501 | 3501 | ||
3502 | /* | 3502 | /* |
@@ -3528,7 +3528,7 @@ static int do_nonlinear_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3528 | } | 3528 | } |
3529 | 3529 | ||
3530 | pgoff = pte_to_pgoff(orig_pte); | 3530 | pgoff = pte_to_pgoff(orig_pte); |
3531 | return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); | 3531 | return do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); |
3532 | } | 3532 | } |
3533 | 3533 | ||
3534 | static int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, | 3534 | static int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, |