The patch titled Subject: mm-memory_hotplug-clean-up-node_states_check_changes_offline-v2 has been added to the -mm tree. Its filename is mm-memory_hotplug-clean-up-node_states_check_changes_offline-v2.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-memory_hotplug-clean-up-node_states_check_changes_offline-v2.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-memory_hotplug-clean-up-node_states_check_changes_offline-v2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Oscar Salvador <osalvador@xxxxxxx> Subject: mm-memory_hotplug-clean-up-node_states_check_changes_offline-v2 - Address feedback from Pavel - Re-write his way, as it is better - Add Reviewed-by from Pavel Link: http://lkml.kernel.org/r/20180921132634.10103-5-osalvador@xxxxxxxxxxxxxxxxxx Signed-off-by: Oscar Salvador <osalvador@xxxxxxx> Reviewed-by: Pavel Tatashin <pavel.tatashin@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory_hotplug.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) --- a/mm/memory_hotplug.c~mm-memory_hotplug-clean-up-node_states_check_changes_offline-v2 +++ a/mm/memory_hotplug.c @@ -1465,6 +1465,10 @@ static void node_states_check_changes_of unsigned long present_pages = 0; enum zone_type zt; + arg->status_change_nid = -1; + arg->status_change_nid_normal = -1; + arg->status_change_nid_high = -1; + /* * Check whether node_states[N_NORMAL_MEMORY] will be changed. * If the memory to be offline is within the range @@ -1477,8 +1481,6 @@ static void node_states_check_changes_of present_pages += pgdat->node_zones[zt].present_pages; if (zone_idx(zone) <= ZONE_NORMAL && nr_pages >= present_pages) arg->status_change_nid_normal = zone_to_nid(zone); - else - arg->status_change_nid_normal = -1; #ifdef CONFIG_HIGHMEM /* @@ -1489,15 +1491,9 @@ static void node_states_check_changes_of * we determine that the zones in that range become empty, * we need to clear the node for N_HIGH_MEMORY. */ - zt = ZONE_HIGHMEM; - present_pages += pgdat->node_zones[zt].present_pages; - - if (zone_idx(zone) <= zt && nr_pages >= present_pages) + present_pages += pgdat->node_zones[ZONE_HIGHMEM].present_pages; + if (zone_idx(zone) <= ZONE_HIGHMEM && nr_pages >= present_pages) arg->status_change_nid_high = zone_to_nid(zone); - else - arg->status_change_nid_high = -1; -#else - arg->status_change_nid_high = arg->status_change_nid_normal; #endif /* @@ -1510,13 +1506,10 @@ static void node_states_check_changes_of * we know that the node will become empty, and so, we can clear * it for N_MEMORY as well. */ - zt = ZONE_MOVABLE; - present_pages += pgdat->node_zones[zt].present_pages; + present_pages += pgdat->node_zones[ZONE_MOVABLE].present_pages; if (nr_pages >= present_pages) arg->status_change_nid = zone_to_nid(zone); - else - arg->status_change_nid = -1; } static void node_states_clear_node(int node, struct memory_notify *arg) _ Patches currently in -mm which might be from osalvador@xxxxxxx are mm-page_alloc-clean-up-check_for_memory.patch mm-memory_hotplug-spare-unnecessary-calls-to-node_set_state.patch mm-memory_hotplug-tidy-up-node_states_clear_node.patch mm-memory_hotplug-simplify-node_states_check_changes_online.patch mm-memory_hotplug-simplify-node_states_check_changes_online-v2.patch mm-memory_hotplug-clean-up-node_states_check_changes_offline.patch mm-memory_hotplug-clean-up-node_states_check_changes_offline-v2.patch