The patch titled Subject: mm/memory_hotplug: online_pages cannot be 0 in online_pages() has been added to the -mm tree. Its filename is mm-memory_hotplug-online_pages-cannot-be-0-in-online_pages.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-memory_hotplug-online_pages-cannot-be-0-in-online_pages.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-memory_hotplug-online_pages-cannot-be-0-in-online_pages.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: David Hildenbrand <david@xxxxxxxxxx> Subject: mm/memory_hotplug: online_pages cannot be 0 in online_pages() walk_system_ram_range() will fail with -EINVAL in case online_pages_range() was never called (== no resource applicable in the range). Otherwise, we will always call online_pages_range() with nr_pages > 0 and, therefore, have online_pages > 0. Remove that special handling. Link: http://lkml.kernel.org/r/20190809125701.3316-5-david@xxxxxxxxxx Signed-off-by: David Hildenbrand <david@xxxxxxxxxx> Cc: Oscar Salvador <osalvador@xxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> Cc: Dan Williams <dan.j.williams@xxxxxxxxx> Cc: Arun KS <arunks@xxxxxxxxxxxxxx> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Nadav Amit <namit@xxxxxxxxxx> Cc: Wei Yang <richardw.yang@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory_hotplug.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) --- a/mm/memory_hotplug.c~mm-memory_hotplug-online_pages-cannot-be-0-in-online_pages +++ a/mm/memory_hotplug.c @@ -854,6 +854,7 @@ int __ref online_pages(unsigned long pfn ret = walk_system_ram_range(pfn, nr_pages, &onlined_pages, online_pages_range); if (ret) { + /* not a single memory resource was applicable */ if (need_zonelists_rebuild) zone_pcp_reset(zone); goto failed_addition; @@ -867,27 +868,22 @@ int __ref online_pages(unsigned long pfn shuffle_zone(zone); - if (onlined_pages) { - node_states_set_node(nid, &arg); - if (need_zonelists_rebuild) - build_all_zonelists(NULL); - else - zone_pcp_update(zone); - } + node_states_set_node(nid, &arg); + if (need_zonelists_rebuild) + build_all_zonelists(NULL); + else + zone_pcp_update(zone); init_per_zone_wmark_min(); - if (onlined_pages) { - kswapd_run(nid); - kcompactd_run(nid); - } + kswapd_run(nid); + kcompactd_run(nid); vm_total_pages = nr_free_pagecache_pages(); writeback_set_ratelimit(); - if (onlined_pages) - memory_notify(MEM_ONLINE, &arg); + memory_notify(MEM_ONLINE, &arg); mem_hotplug_done(); return 0; _ Patches currently in -mm which might be from david@xxxxxxxxxx are mm-memory_hotplug-remove-move_pfn_range.patch drivers-base-nodec-simplify-unregister_memory_block_under_nodes.patch drivers-base-memoryc-fixup-documentation-of-removable-phys_index-block_size_bytes.patch driver-base-memoryc-validate-memory-block-size-early.patch resource-use-pfn_up-pfn_down-in-walk_system_ram_range.patch mm-memory_hotplug-handle-unaligned-start-and-nr_pages-in-online_pages_blocks.patch mm-memory_hotplug-simplify-online_pages_range.patch mm-memory_hotplug-online_pages-cannot-be-0-in-online_pages.patch