Skip to content

Commit

Permalink
mm/memblock.c: hardcode the end_pfn being -1
Browse files Browse the repository at this point in the history
This is just a cleanup.  It aids handling the special end case in the
next commit.

[[email protected]: make it work against current -linus, not against -mm]
[[email protected]: 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 <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Pavel Tatashin <[email protected]>
Cc: Paul Burton <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Daniel Vacek authored and torvalds committed Mar 10, 2018
1 parent 96312e6 commit 379b03b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mm/memblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
struct memblock_type *type = &memblock.memory;
unsigned int right = type->cnt;
unsigned int mid, left = 0;
phys_addr_t addr = PFN_PHYS(pfn + 1);
phys_addr_t addr = PFN_PHYS(++pfn);

do {
mid = (right + left) / 2;
Expand All @@ -1118,15 +1118,15 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
type->regions[mid].size))
left = mid + 1;
else {
/* addr is within the region, so pfn + 1 is valid */
return min(pfn + 1, max_pfn);
/* addr is within the region, so pfn is valid */
return pfn;
}
} while (left < right);

if (right == type->cnt)
return max_pfn;
return -1UL;
else
return min(PHYS_PFN(type->regions[right].base), max_pfn);
return PHYS_PFN(type->regions[right].base);
}

/**
Expand Down

0 comments on commit 379b03b

Please sign in to comment.