* [PATCH V2] powerpc/mm: Update mm context addr limit correctly.
@ 2017-04-18 7:01 Aneesh Kumar K.V
2017-04-19 22:04 ` [V2] " Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Aneesh Kumar K.V @ 2017-04-18 7:01 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: linuxppc-dev, Aneesh Kumar K.V
We added the addr < TASK_SIZE check to avoid updating addr_limit unnecessarily and
also to avoid calling slice_flush_segments on all the cpus. This had the side
effect of having different behaviour when using an addr value above TASK_SIZE
before updating addr_limit and after updating addr_limit as show by below
output:
requesting with hint 0x0
Addr returned 0x7fff893a0000
requesting with hint 0xffffffffffffffff
Addr returned 0x7fff891b0000 <===== 1st return
requesting with hint 0x1000000000000
Addr returned 0x1000000000000
requesting with hint 0xffffffffffffffff
Addr returned 0x1ffff89410000 <==== second return
After fix:
requesting with hint 0x0
Addr returned 0x7fff8bc00000
requesting with hint 0xffffffffffffffff
Addr returned 0x1ffff8bc80000 <==== 1st return
requesting with hint 0x1000000000000
Addr returned 0x1000000000000
requesting with hint 0xffffffffffffffff
Addr returned 0x1ffff8bc60000 <==== second return
This also bring the ABI in-line with what is proposed on x86. ie, to use
a hint addr above 128TB up to and including (2^64)-1 as an indication to search
the full address space.
Fixes: f4ea6dcb08ea2c (powerpc/mm: Enable mappings above 128TB)
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
Changes from V1:
* Update with correct Fixes: sha1
* Also add information about how hint addr is used
arch/powerpc/mm/mmap.c | 6 ++++--
arch/powerpc/mm/slice.c | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c
index b2111baa0da6..355b6fe8a1e6 100644
--- a/arch/powerpc/mm/mmap.c
+++ b/arch/powerpc/mm/mmap.c
@@ -97,7 +97,8 @@ radix__arch_get_unmapped_area(struct file *filp, unsigned long addr,
struct vm_area_struct *vma;
struct vm_unmapped_area_info info;
- if (unlikely(addr > mm->context.addr_limit && addr < TASK_SIZE))
+ if (unlikely(addr > mm->context.addr_limit &&
+ mm->context.addr_limit != TASK_SIZE))
mm->context.addr_limit = TASK_SIZE;
if (len > mm->context.addr_limit - mmap_min_addr)
@@ -139,7 +140,8 @@ radix__arch_get_unmapped_area_topdown(struct file *filp,
unsigned long addr = addr0;
struct vm_unmapped_area_info info;
- if (unlikely(addr > mm->context.addr_limit && addr < TASK_SIZE))
+ if (unlikely(addr > mm->context.addr_limit &&
+ mm->context.addr_limit != TASK_SIZE))
mm->context.addr_limit = TASK_SIZE;
/* requested length too big for entire address space */
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index 251b6bae7023..2d2d9760d057 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -419,7 +419,8 @@ 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 && addr < TASK_SIZE)) {
+ 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);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [V2] powerpc/mm: Update mm context addr limit correctly.
2017-04-18 7:01 [PATCH V2] powerpc/mm: Update mm context addr limit correctly Aneesh Kumar K.V
@ 2017-04-19 22:04 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2017-04-19 22:04 UTC (permalink / raw)
To: Aneesh Kumar K.V, benh, paulus; +Cc: linuxppc-dev, Aneesh Kumar K.V
On Tue, 2017-04-18 at 07:01:27 UTC, "Aneesh Kumar K.V" wrote:
> We added the addr < TASK_SIZE check to avoid updating addr_limit unnecessarily and
> also to avoid calling slice_flush_segments on all the cpus. This had the side
> effect of having different behaviour when using an addr value above TASK_SIZE
> before updating addr_limit and after updating addr_limit as show by below
> output:
...
>
> This also bring the ABI in-line with what is proposed on x86. ie, to use
> a hint addr above 128TB up to and including (2^64)-1 as an indication to search
> the full address space.
>
> Fixes: f4ea6dcb08ea2c (powerpc/mm: Enable mappings above 128TB)
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/321f7d29e5163d7f1c9c0b705acc45
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-19 22:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-18 7:01 [PATCH V2] powerpc/mm: Update mm context addr limit correctly Aneesh Kumar K.V
2017-04-19 22:04 ` [V2] " Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.