Skip to content

Commit

Permalink
powerpc/64s/hash: Fix 512T hint detection to use >= 128T
Browse files Browse the repository at this point in the history
Currently userspace is able to request mmap() search between 128T-512T
by specifying a hint address that is greater than 128T. But that means
a hint of 128T exactly will return an address below 128T, which is
confusing and wrong.

So fix the logic to check the hint is greater than *or equal* to 128T.

Fixes: f4ea6dc ("powerpc/mm: Enable mappings above 128TB")
Cc: [email protected] # v4.12+
Suggested-by: Aneesh Kumar K.V <[email protected]>
Suggested-by: Nicholas Piggin <[email protected]>
[mpe: Split out of Nick's bigger patch]
Signed-off-by: Michael Ellerman <[email protected]>
  • Loading branch information
mpe committed Nov 13, 2017
1 parent f23ab3e commit 7ece370
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/powerpc/mm/slice.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,15 +419,15 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
/*
* Check if we need to expland slice area.
*/
if (unlikely(addr > mm->context.addr_limit &&
if (unlikely(addr >= mm->context.addr_limit &&
mm->context.addr_limit != TASK_SIZE)) {
mm->context.addr_limit = TASK_SIZE;
on_each_cpu(slice_flush_segments, mm, 1);
}
/*
* This mmap request can allocate upt to 512TB
*/
if (addr > DEFAULT_MAP_WINDOW)
if (addr >= DEFAULT_MAP_WINDOW)
high_limit = mm->context.addr_limit;
else
high_limit = DEFAULT_MAP_WINDOW;
Expand Down

0 comments on commit 7ece370

Please sign in to comment.