[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1351256077-1594-2-git-send-email-kirill.shutemov@linux.intel.com>
Date: Fri, 26 Oct 2012 15:54:35 +0300
From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To: linux-mm@...ck.org
Cc: Will Deacon <will.deacon@....com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>,
Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] numa, mm: consolidate error path in do_huge_pmd_numa_page()
From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Let's move all error path code to the end if the function. It makes code
more straight-forward.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
---
mm/huge_memory.c | 44 ++++++++++++++++++++------------------------
1 file changed, 20 insertions(+), 24 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 9bb2c23..95ec485 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -759,30 +759,14 @@ void do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma,
goto unlock;
page = pmd_page(entry);
- if (page) {
- VM_BUG_ON(!PageCompound(page) || !PageHead(page));
-
- get_page(page);
- node = mpol_misplaced(page, vma, haddr);
- if (node != -1)
- goto migrate;
- }
-
-fixup:
- /* change back to regular protection */
- entry = pmd_modify(entry, vma->vm_page_prot);
- set_pmd_at(mm, haddr, pmd, entry);
- update_mmu_cache_pmd(vma, address, entry);
-
-unlock:
- spin_unlock(&mm->page_table_lock);
- if (page) {
- task_numa_fault(page_to_nid(page), HPAGE_PMD_NR);
- put_page(page);
- }
- return;
+ if (!page)
+ goto fixup;
+ VM_BUG_ON(!PageCompound(page) || !PageHead(page));
-migrate:
+ get_page(page);
+ node = mpol_misplaced(page, vma, haddr);
+ if (node == -1)
+ goto fixup;
spin_unlock(&mm->page_table_lock);
lock_page(page);
@@ -871,7 +855,19 @@ alloc_fail:
page = NULL;
goto unlock;
}
- goto fixup;
+fixup:
+ /* change back to regular protection */
+ entry = pmd_modify(entry, vma->vm_page_prot);
+ set_pmd_at(mm, haddr, pmd, entry);
+ update_mmu_cache_pmd(vma, address, entry);
+
+unlock:
+ spin_unlock(&mm->page_table_lock);
+ if (page) {
+ task_numa_fault(page_to_nid(page), HPAGE_PMD_NR);
+ put_page(page);
+ }
+ return;
}
int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists