Skip to content

Commit 379b03b

Browse files
Daniel Vacektorvalds
authored andcommitted
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>
1 parent 96312e6 commit 379b03b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mm/memblock.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
11071107
struct memblock_type *type = &memblock.memory;
11081108
unsigned int right = type->cnt;
11091109
unsigned int mid, left = 0;
1110-
phys_addr_t addr = PFN_PHYS(pfn + 1);
1110+
phys_addr_t addr = PFN_PHYS(++pfn);
11111111

11121112
do {
11131113
mid = (right + left) / 2;
@@ -1118,15 +1118,15 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
11181118
type->regions[mid].size))
11191119
left = mid + 1;
11201120
else {
1121-
/* addr is within the region, so pfn + 1 is valid */
1122-
return min(pfn + 1, max_pfn);
1121+
/* addr is within the region, so pfn is valid */
1122+
return pfn;
11231123
}
11241124
} while (left < right);
11251125

11261126
if (right == type->cnt)
1127-
return max_pfn;
1127+
return -1UL;
11281128
else
1129-
return min(PHYS_PFN(type->regions[right].base), max_pfn);
1129+
return PHYS_PFN(type->regions[right].base);
11301130
}
11311131

11321132
/**

0 commit comments

Comments
 (0)