From: Xiao Guangrong Date: Fri, 21 Sep 2012 00:57:26 +0000 (+1000) Subject: thp: remove some code depend on CONFIG_NUMA X-Git-Tag: next-20120921~6^2~296 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c97c1caa8fc3a16acc9e5983b101ff6f5aba17ed;p=karo-tx-linux.git 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 Cc: Andrea Arcangeli Cc: Hugh Dickins Cc: David Rientjes Signed-off-by: Andrew Morton --- diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 5699bc040a40..e5ceb6f55fc7 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2307,11 +2307,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(); @@ -2325,10 +2322,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(); }