The patch titled Subject: mm/sparsemem: cleanup 'section number' data types has been added to the -mm tree. Its filename is mm-sparsemem-cleanup-section-number-data-types.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-sparsemem-cleanup-section-number-data-types.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-sparsemem-cleanup-section-number-data-types.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: Dan Williams <dan.j.williams@xxxxxxxxx> Subject: mm/sparsemem: cleanup 'section number' data types David points out that there is a mixture of 'int' and 'unsigned long' usage for section number data types. Update the memory hotplug path to use 'unsigned long' consistently for section numbers. Link: http://lkml.kernel.org/r/156107543656.1329419.11505835211949439815.stgit@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx> Reported-by: David Hildenbrand <david@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Oscar Salvador <osalvador@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory_hotplug.c | 10 +++++----- mm/sparse.c | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) --- a/mm/memory_hotplug.c~mm-sparsemem-cleanup-section-number-data-types +++ a/mm/memory_hotplug.c @@ -288,8 +288,8 @@ static int check_pfn_span(unsigned long int __ref __add_pages(int nid, unsigned long pfn, unsigned long nr_pages, struct mhp_restrictions *restrictions) { - unsigned long i; - int start_sec, end_sec, err; + int err; + unsigned long nr, start_sec, end_sec; struct vmem_altmap *altmap = restrictions->altmap; if (altmap) { @@ -310,7 +310,7 @@ int __ref __add_pages(int nid, unsigned start_sec = pfn_to_section_nr(pfn); end_sec = pfn_to_section_nr(pfn + nr_pages - 1); - for (i = start_sec; i <= end_sec; i++) { + for (nr = start_sec; nr <= end_sec; nr++) { unsigned long pfns; pfns = min(nr_pages, PAGES_PER_SECTION @@ -541,7 +541,7 @@ void __remove_pages(struct zone *zone, u unsigned long nr_pages, struct vmem_altmap *altmap) { unsigned long map_offset = 0; - int i, start_sec, end_sec; + unsigned long nr, start_sec, end_sec; if (altmap) map_offset = vmem_altmap_offset(altmap); @@ -553,7 +553,7 @@ void __remove_pages(struct zone *zone, u start_sec = pfn_to_section_nr(pfn); end_sec = pfn_to_section_nr(pfn + nr_pages - 1); - for (i = start_sec; i <= end_sec; i++) { + for (nr = start_sec; nr <= end_sec; nr++) { unsigned long pfns; cond_resched(); --- a/mm/sparse.c~mm-sparsemem-cleanup-section-number-data-types +++ a/mm/sparse.c @@ -229,21 +229,21 @@ void subsection_mask_set(unsigned long * void __init subsection_map_init(unsigned long pfn, unsigned long nr_pages) { int end_sec = pfn_to_section_nr(pfn + nr_pages - 1); - int i, start_sec = pfn_to_section_nr(pfn); + unsigned long nr, start_sec = pfn_to_section_nr(pfn); if (!nr_pages) return; - for (i = start_sec; i <= end_sec; i++) { + for (nr = start_sec; nr <= end_sec; nr++) { struct mem_section *ms; unsigned long pfns; pfns = min(nr_pages, PAGES_PER_SECTION - (pfn & ~PAGE_SECTION_MASK)); - ms = __nr_to_section(i); + ms = __nr_to_section(nr); subsection_mask_set(ms->usage->subsection_map, pfn, pfns); - pr_debug("%s: sec: %d pfns: %ld set(%d, %d)\n", __func__, i, + pr_debug("%s: sec: %d pfns: %ld set(%d, %d)\n", __func__, nr, pfns, subsection_map_index(pfn), subsection_map_index(pfn + pfns - 1)); _ Patches currently in -mm which might be from dan.j.williams@xxxxxxxxx are mm-sparsemem-introduce-struct-mem_section_usage.patch mm-sparsemem-introduce-a-section_is_early-flag.patch mm-sparsemem-add-helpers-track-active-portions-of-a-section-at-boot.patch mm-hotplug-prepare-shrink_zone-pgdat_span-for-sub-section-removal.patch mm-sparsemem-convert-kmalloc_section_memmap-to-populate_section_memmap.patch mm-hotplug-kill-is_dev_zone-usage-in-__remove_pages.patch mm-kill-is_dev_zone-helper.patch mm-sparsemem-prepare-for-sub-section-ranges.patch mm-sparsemem-support-sub-section-hotplug.patch mm-document-zone_device-memory-model-implications.patch mm-devm_memremap_pages-enable-sub-section-remap.patch libnvdimm-pfn-fix-fsdax-mode-namespace-info-block-zero-fields.patch libnvdimm-pfn-stop-padding-pmem-namespaces-to-section-alignment.patch mm-sparsemem-cleanup-section-number-data-types.patch