From: Mel Gorman <mgorman@suse.de>
Date: Thu, 6 Feb 2014 10:28:22 +0000
Subject: [PATCH] mm: Warn users of node memory hot-remove if the memory ratio
is a high risk
References: Memory node hot-remove (fate#316483), fate#319143, bnc#987598
Patch-mainline: Never, upstream developers refusing to acknowledge problem
Warn users of zone_movable (currently memory hot-remove or mirrored memory) if
lowmem:movable ratio is worse than 1:3. Such a configuration can lead to all sorts
of problems and it would be good to have a reminder that the zone_movable might
be the culprit.
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Michal Hocko <mhocko@suse.cz>
---
mm/page_alloc.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4759,6 +4759,30 @@ void __ref build_all_zonelists(pg_data_t
#ifdef CONFIG_NUMA
pr_info("Policy zone: %s\n", zone_names[policy_zone]);
#endif
+
+ /*
+ * Check normal :movable ratio when memory node hot-remove/mirrored
+ * memory is enabled
+ */
+ if (movable_node_is_enabled()) {
+ unsigned long nr_movable = 0;
+
+ for_each_zone(zone) {
+ if (!populated_zone(zone) || zone_idx(zone) != ZONE_MOVABLE)
+ continue;
+
+ nr_movable += zone->managed_pages;
+ }
+
+ /* Warn if lowmem:movable is worse than 1:3 */
+ if ((vm_total_pages >> 2) < nr_movable) {
+ pr_warn("lowmem:movable memory is very high. "
+ "There may be OOM or performance problems if the kernel "
+ "cannot allocate memory as it is all marked "
+ "for movable nodes.\n");
+ WARN_ON_ONCE(1);
+ }
+ }
}
/*