The patch titled Subject: mm: fix register_new_memory() zone type detection has been removed from the -mm tree. Its filename was mm-fix-register_new_memory-zone-type-detection.patch This patch was dropped because an updated version will be merged ------------------------------------------------------ From: Dan Williams <dan.j.williams@xxxxxxxxx> Subject: mm: fix register_new_memory() zone type detection In preparation for sub-section memory hotplug support, remove a dependency on ->section_mem_map being populated. In SPARSEMEM_VMEMMAP=y configurations pfn_to_page() does not use ->section_mem_map. The sub-section hotplug support relies on this fact and skips initializing it. Without ->section_mem_map populated, or aligned to section boundary, conversions of mem_section instances to zones is not possible. So, this removes a false dependency on a structure field that will only be valid in the SPARSEMEM_VMEMMAP=n case, and only used for pfn_to_page() (and similar) operations. Link: http://lkml.kernel.org/r/148486363923.19694.16803321290568634521.stgit@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Logan Gunthorpe <logang@xxxxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Cc: Stephen Bates <stephen.bates@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/base/memory.c | 26 +++++++++----------------- include/linux/memory.h | 4 ++-- mm/memory_hotplug.c | 4 ++-- 3 files changed, 13 insertions(+), 21 deletions(-) diff -puN drivers/base/memory.c~mm-fix-register_new_memory-zone-type-detection drivers/base/memory.c --- a/drivers/base/memory.c~mm-fix-register_new_memory-zone-type-detection +++ a/drivers/base/memory.c @@ -685,24 +685,16 @@ static int add_memory_block(int base_sec return 0; } -static bool is_zone_device_section(struct mem_section *ms) -{ - struct page *page; - - page = sparse_decode_mem_map(ms->section_mem_map, __section_nr(ms)); - return is_zone_device_page(page); -} - /* * need an interface for the VM to add new memory regions, * but without onlining it. */ -int register_new_memory(int nid, struct mem_section *section) +int register_new_memory(struct zone *zone, int nid, struct mem_section *section) { int ret = 0; struct memory_block *mem; - if (is_zone_device_section(section)) + if (is_dev_zone(zone)) return 0; mutex_lock(&mem_sysfs_mutex); @@ -736,14 +728,11 @@ unregister_memory(struct memory_block *m device_unregister(&memory->dev); } -static int remove_memory_section(unsigned long node_id, - struct mem_section *section, int phys_device) +static int remove_memory_section(struct zone *zone, unsigned long node_id, + struct mem_section *section, int phys_device) { struct memory_block *mem; - if (is_zone_device_section(section)) - return 0; - mutex_lock(&mem_sysfs_mutex); mem = find_memory_block(section); unregister_mem_sect_under_nodes(mem, __section_nr(section)); @@ -758,12 +747,15 @@ static int remove_memory_section(unsigne return 0; } -int unregister_memory_section(struct mem_section *section) +int unregister_memory_section(struct zone *zone, struct mem_section *section) { + if (is_dev_zone(zone)) + return 0; + if (!present_section(section)) return -EINVAL; - return remove_memory_section(0, section, 0); + return remove_memory_section(zone, 0, section, 0); } #endif /* CONFIG_MEMORY_HOTREMOVE */ diff -puN include/linux/memory.h~mm-fix-register_new_memory-zone-type-detection include/linux/memory.h --- a/include/linux/memory.h~mm-fix-register_new_memory-zone-type-detection +++ a/include/linux/memory.h @@ -108,12 +108,12 @@ extern int register_memory_notifier(stru extern void unregister_memory_notifier(struct notifier_block *nb); extern int register_memory_isolate_notifier(struct notifier_block *nb); extern void unregister_memory_isolate_notifier(struct notifier_block *nb); -extern int register_new_memory(int, struct mem_section *); +extern int register_new_memory(struct zone *, int, struct mem_section *); extern int memory_block_change_state(struct memory_block *mem, unsigned long to_state, unsigned long from_state_req); #ifdef CONFIG_MEMORY_HOTREMOVE -extern int unregister_memory_section(struct mem_section *); +extern int unregister_memory_section(struct zone *, struct mem_section *); #endif extern int memory_dev_init(void); extern int memory_notify(unsigned long val, void *v); diff -puN mm/memory_hotplug.c~mm-fix-register_new_memory-zone-type-detection mm/memory_hotplug.c --- a/mm/memory_hotplug.c~mm-fix-register_new_memory-zone-type-detection +++ a/mm/memory_hotplug.c @@ -517,7 +517,7 @@ static int __meminit __add_section(int n if (ret < 0) return ret; - return register_new_memory(nid, __pfn_to_section(phys_start_pfn)); + return register_new_memory(zone, nid, __pfn_to_section(phys_start_pfn)); } /* @@ -784,7 +784,7 @@ static int __remove_section(struct zone if (!valid_section(ms)) return ret; - ret = unregister_memory_section(ms); + ret = unregister_memory_section(zone, ms); if (ret) return ret; _ Patches currently in -mm which might be from dan.j.williams@xxxxxxxxx are mm-convert-kmalloc_section_memmap-to-populate_section_memmap.patch mm-prepare-for-hot-add-remove-of-sub-section-ranges.patch mm-support-section-unaligned-zone_device-memory-ranges.patch mm-enable-section-unaligned-devm_memremap_pages.patch libnvdimm-pfn-dax-stop-padding-pmem-namespaces-to-section-alignment.patch mm-fix-get_user_pages-vs-device-dax-pud-mappings.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html