powerpc/mm: Update mm context addr limit correctly.
PATCH 1/1 powerpc/mm: Update mm context addr limit correctly.
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
--- arch/powerpc/mm/mmap.c | 6 ++++-- arch/powerpc/mm/slice.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-)
arch/powerpc/mm/mmap.c +4 -2
@@ -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 */
arch/powerpc/mm/slice.c +2 -1
@@ -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 ); }
Signature · 1 line
2.7.4