Commit 379b03b7 authored by Daniel Vacek's avatar Daniel Vacek Committed by Linus Torvalds

mm/memblock.c: hardcode the end_pfn being -1

This is just a cleanup.  It aids handling the special end case in the
next commit.

[akpm@linux-foundation.org: make it work against current -linus, not against -mm]
[akpm@linux-foundation.org: make it work against current -linus, not against -mm some more]
Link: http://lkml.kernel.org/r/1ca478d4269125a99bcfb1ca04d7b88ac1aee924.1520011944.git.neelx@redhat.comSigned-off-by: default avatarDaniel Vacek <neelx@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Pavel Tatashin <pasha.tatashin@oracle.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 96312e61
...@@ -1107,7 +1107,7 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn, ...@@ -1107,7 +1107,7 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
struct memblock_type *type = &memblock.memory; struct memblock_type *type = &memblock.memory;
unsigned int right = type->cnt; unsigned int right = type->cnt;
unsigned int mid, left = 0; unsigned int mid, left = 0;
phys_addr_t addr = PFN_PHYS(pfn + 1); phys_addr_t addr = PFN_PHYS(++pfn);
do { do {
mid = (right + left) / 2; mid = (right + left) / 2;
...@@ -1118,15 +1118,15 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn, ...@@ -1118,15 +1118,15 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
type->regions[mid].size)) type->regions[mid].size))
left = mid + 1; left = mid + 1;
else { else {
/* addr is within the region, so pfn + 1 is valid */ /* addr is within the region, so pfn is valid */
return min(pfn + 1, max_pfn); return pfn;
} }
} while (left < right); } while (left < right);
if (right == type->cnt) if (right == type->cnt)
return max_pfn; return -1UL;
else else
return min(PHYS_PFN(type->regions[right].base), max_pfn); return PHYS_PFN(type->regions[right].base);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment