summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorDan Williams2019-07-19 00:58:43 +0200
committerLinus Torvalds2019-07-19 02:08:07 +0200
commit9a845030427c7a2879a7d635cc7c0e5f79ec962d (patch)
tree065459104d601679ea9cd203c8360d0826c10261 /mm
parentlibnvdimm/pfn: stop padding pmem namespaces to section alignment (diff)
downloadkernel-qcow2-linux-9a845030427c7a2879a7d635cc7c0e5f79ec962d.tar.gz
kernel-qcow2-linux-9a845030427c7a2879a7d635cc7c0e5f79ec962d.tar.xz
kernel-qcow2-linux-9a845030427c7a2879a7d635cc7c0e5f79ec962d.zip
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. [akpm@linux-foundation.org: fix printk format] Link: http://lkml.kernel.org/r/156107543656.1329419.11505835211949439815.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reported-by: David Hildenbrand <david@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Oscar Salvador <osalvador@suse.de> Cc: Jason Gunthorpe <jgg@mellanox.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memory_hotplug.c10
-rw-r--r--mm/sparse.c8
2 files changed, 9 insertions, 9 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index aafb71594ee3..2a9bbddb0e55 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -288,8 +288,8 @@ static int check_pfn_span(unsigned long pfn, unsigned long nr_pages,
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 long pfn, unsigned long nr_pages,
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, unsigned long pfn,
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;
map_offset = vmem_altmap_offset(altmap);
@@ -552,7 +552,7 @@ void __remove_pages(struct zone *zone, unsigned long pfn,
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();
diff --git a/mm/sparse.c b/mm/sparse.c
index a205a2ac66a4..72f010d9bff5 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -229,21 +229,21 @@ void subsection_mask_set(unsigned long *map, unsigned long pfn,
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: %lu pfns: %lu set(%d, %d)\n", __func__, nr,
pfns, subsection_map_index(pfn),
subsection_map_index(pfn + pfns - 1));