aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>2012-10-08 19:29:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:22:26 -0400
commit9817626e722a5e5699cf38f5d3a4c9851e054436 (patch)
treef8826ef7cf4182a963350d421991f2f3b26a30d9 /mm
parent2017c0bff8ba79ea527361adbe19471e174775d6 (diff)
thp: remove some code depend on CONFIG_NUMA
If NUMA is disabled, hpage is used as page pre-alloc, so there are two cases for hpage: - it is !NULL, means the page is not consumed otherwise, - the page has been consumed If NUMA is enabled, hpage is just used as alloc-fail indicator which is not a real page, NULL means not fail triggered. So, we can release the page only if !IS_ERR_OR_NULL Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/huge_memory.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index a94c07a1b3c..1e21b4cf4c7 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2306,11 +2306,8 @@ static void khugepaged_wait_work(void)
2306 2306
2307static void khugepaged_loop(void) 2307static void khugepaged_loop(void)
2308{ 2308{
2309 struct page *hpage; 2309 struct page *hpage = NULL;
2310 2310
2311#ifdef CONFIG_NUMA
2312 hpage = NULL;
2313#endif
2314 while (likely(khugepaged_enabled())) { 2311 while (likely(khugepaged_enabled())) {
2315#ifndef CONFIG_NUMA 2312#ifndef CONFIG_NUMA
2316 hpage = khugepaged_alloc_hugepage(); 2313 hpage = khugepaged_alloc_hugepage();
@@ -2324,10 +2321,9 @@ static void khugepaged_loop(void)
2324#endif 2321#endif
2325 2322
2326 khugepaged_do_scan(&hpage); 2323 khugepaged_do_scan(&hpage);
2327#ifndef CONFIG_NUMA 2324
2328 if (hpage) 2325 if (!IS_ERR_OR_NULL(hpage))
2329 put_page(hpage); 2326 put_page(hpage);
2330#endif
2331 2327
2332 khugepaged_wait_work(); 2328 khugepaged_wait_work();
2333 } 2329 }