aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vacek <neelx@redhat.com>2018-03-09 18:51:09 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-03-09 19:40:01 -0500
commit379b03b7fa05f7db521b7732a52692448a3c34fe (patch)
tree020d08568f6447fb0b09a353da2380b4d4f6edca
parent96312e61282ae3f6537a562625706498cbc75594 (diff)
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.com Signed-off-by: Daniel 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/memblock.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 5a9ca2a1751b..b6ba6b7adadc 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1107,7 +1107,7 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
1107 struct memblock_type *type = &memblock.memory; 1107 struct memblock_type *type = &memblock.memory;
1108 unsigned int right = type->cnt; 1108 unsigned int right = type->cnt;
1109 unsigned int mid, left = 0; 1109 unsigned int mid, left = 0;
1110 phys_addr_t addr = PFN_PHYS(pfn + 1); 1110 phys_addr_t addr = PFN_PHYS(++pfn);
1111 1111
1112 do { 1112 do {
1113 mid = (right + left) / 2; 1113 mid = (right + left) / 2;
@@ -1118,15 +1118,15 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
1118 type->regions[mid].size)) 1118 type->regions[mid].size))
1119 left = mid + 1; 1119 left = mid + 1;
1120 else { 1120 else {
1121 /* addr is within the region, so pfn + 1 is valid */ 1121 /* addr is within the region, so pfn is valid */
1122 return min(pfn + 1, max_pfn); 1122 return pfn;
1123 } 1123 }
1124 } while (left < right); 1124 } while (left < right);
1125 1125
1126 if (right == type->cnt) 1126 if (right == type->cnt)
1127 return max_pfn; 1127 return -1UL;
1128 else 1128 else
1129 return min(PHYS_PFN(type->regions[right].base), max_pfn); 1129 return PHYS_PFN(type->regions[right].base);
1130} 1130}
1131 1131
1132/** 1132/**