diff --git a/mm/huge_memory.c b/mm/huge_memory.c index a94c07a1b3c543609365849a407b5ce6d61c2a70..1e21b4cf4c75c0bb9d2cf35329637779ff63a1c6 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2306,11 +2306,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(); @@ -2324,10 +2321,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(); }