]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
thp: remove some code depend on CONFIG_NUMA
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Wed, 26 Sep 2012 01:33:22 +0000 (11:33 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 26 Sep 2012 05:41:35 +0000 (15:41 +1000)
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>
mm/huge_memory.c

index cc03fa60b2ffcb12f476a6e6a7118101d5ed4e32..049bf8b8b0053caef752b0b807b462429372443e 100644 (file)
@@ -2324,11 +2324,8 @@ static void khugepaged_wait_work(void)
 
 static void khugepaged_loop(void)
 {
-       struct page *hpage;
+       struct page *hpage = NULL;
 
-#ifdef CONFIG_NUMA
-       hpage = NULL;
-#endif
        while (likely(khugepaged_enabled())) {
 #ifndef CONFIG_NUMA
                hpage = khugepaged_alloc_hugepage();
@@ -2342,10 +2339,9 @@ static void khugepaged_loop(void)
 #endif
 
                khugepaged_do_scan(&hpage);
-#ifndef CONFIG_NUMA
-               if (hpage)
+
+               if (!IS_ERR_OR_NULL(hpage))
                        put_page(hpage);
-#endif
 
                khugepaged_wait_work();
        }