Commit 7b1f624b authored by Jason Baron's avatar Jason Baron Committed by Sasha Levin

mm: update min_free_kbytes from khugepaged after core initialization

[ Upstream commit bc22af74 ]

Khugepaged attempts to raise min_free_kbytes if its set too low.
However, on boot khugepaged sets min_free_kbytes first from
subsys_initcall(), and then the mm 'core' over-rides min_free_kbytes
after from init_per_zone_wmark_min(), via a module_init() call.

Khugepaged used to use a late_initcall() to set min_free_kbytes (such
that it occurred after the core initialization), however this was
removed when the initialization of min_free_kbytes was integrated into
the starting of the khugepaged thread.

The fix here is simply to invoke the core initialization using a
core_initcall() instead of module_init(), such that the previous
initialization ordering is restored.  I didn't restore the
late_initcall() since start_stop_khugepaged() already sets
min_free_kbytes via set_recommended_min_free_kbytes().

This was noticed when we had a number of page allocation failures when
moving a workload to a kernel with this new initialization ordering.  On
an 8GB system this restores min_free_kbytes back to 67584 from 11365
when CONFIG_TRANSPARENT_HUGEPAGE=y is set and either
CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y or
CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y.

Fixes: 79553da2 ("thp: cleanup khugepaged startup")
Signed-off-by: default avatarJason Baron <jbaron@akamai.com>
Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 93c4863f
...@@ -5926,7 +5926,7 @@ int __meminit init_per_zone_wmark_min(void) ...@@ -5926,7 +5926,7 @@ int __meminit init_per_zone_wmark_min(void)
setup_per_zone_inactive_ratio(); setup_per_zone_inactive_ratio();
return 0; return 0;
} }
module_init(init_per_zone_wmark_min) core_initcall(init_per_zone_wmark_min)
/* /*
* min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment