From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: linux-mm@kvack.org
Cc: Will Deacon <will.deacon@arm.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Andrea Arcangeli <aarcange@redhat.com>,
Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] numa, mm: consolidate error path in do_huge_pmd_numa_page()
Date: Fri, 26 Oct 2012 15:54:35 +0300 [thread overview]
Message-ID: <1351256077-1594-2-git-send-email-kirill.shutemov@linux.intel.com> (raw)
In-Reply-To: <1351256077-1594-1-git-send-email-kirill.shutemov@linux.intel.com>
From: "Kirill A. Shutemov" <kirill.shutemov@linux.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@linux.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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-10-26 12:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-26 12:54 [PATCH 1/2] numa, mm: drop redundant check in do_huge_pmd_numa_page() Kirill A. Shutemov
2012-10-26 12:54 ` Kirill A. Shutemov [this message]
2012-10-26 13:10 ` [PATCH 2/2] numa, mm: consolidate error path " Peter Zijlstra
2012-10-26 13:08 ` [PATCH 1/2] numa, mm: drop redundant check " Peter Zijlstra
2012-10-26 13:41 ` Kirill A. Shutemov
2012-10-26 13:43 ` Peter Zijlstra
2012-10-26 13:57 ` Kirill A. Shutemov
2012-10-26 14:07 ` Peter Zijlstra
2012-10-26 14:34 ` Kirill A. Shutemov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1351256077-1594-2-git-send-email-kirill.shutemov@linux.intel.com \
--to=kirill.shutemov@linux.intel.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=will.deacon@arm.com \
--cc=xiaoguangrong@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).