vm_unmapped_area: finish the mission
Subsystems (19)
cover vm_unmapped_area: finish the mission
These patches, which apply on top of v3.8-rc kernels, are to complete the VMA gap finding code I introduced (following Rik's initial proposal) in v3.8-rc1.
First 5 patches introduce the use of vm_unmapped_area() to replace brute force searches on parisc, alpha, frv and ia64 architectures (all relatively trivial uses of the vm_unmapped_area() infrastructure)
Next 2 patches do the same as above for the powerpc architecture. This change is not as trivial as for the other architectures, because we need to account for each address space slice potentially having a different page size.
The last patch removes the free_area_cache, which was used by all the brute force searches before they got converted to the vm_unmapped_area() infrastructure.
I did some basic testing on x86 and powerpc; however the first 5 (simpler) patches for parisc, alpha, frv and ia64 architectures are untested.
Michel Lespinasse (8):
mm: use vm_unmapped_area() on parisc architecture
mm: use vm_unmapped_area() on alpha architecture
mm: use vm_unmapped_area() on frv architecture
mm: use vm_unmapped_area() on ia64 architecture
mm: use vm_unmapped_area() in hugetlbfs on ia64 architecture
mm: remove free_area_cache use in powerpc architecture
mm: use vm_unmapped_area() on powerpc architecture
mm: remove free_area_cache
arch/alpha/kernel/osf_sys.c | 20 ++-- arch/arm/mm/mmap.c | 2 - arch/arm64/mm/mmap.c | 2 - arch/frv/mm/elf-fdpic.c | 49 +++---- arch/ia64/kernel/sys_ia64.c | 37 ++---- arch/ia64/mm/hugetlbpage.c | 20 ++-- arch/mips/mm/mmap.c | 2 - arch/parisc/kernel/sys_parisc.c | 46 +++---- arch/powerpc/include/asm/page_64.h | 3 +- arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/mm/mmap_64.c | 2 - arch/powerpc/mm/slice.c | 228 +++++++++++++----------------- arch/powerpc/platforms/cell/spufs/file.c | 2 +- arch/s390/mm/mmap.c | 4 - arch/sparc/kernel/sys_sparc_64.c | 2 - arch/tile/mm/mmap.c | 2 - arch/x86/ia32/ia32_aout.c | 2 - arch/x86/mm/mmap.c | 2 - fs/binfmt_aout.c | 2 - fs/binfmt_elf.c | 2 - include/linux/mm_types.h | 3 - include/linux/sched.h | 2 - kernel/fork.c | 4 - mm/mmap.c | 28 ---- mm/nommu.c | 4 - mm/util.c | 1 - 26 files changed, 163 insertions(+), 310 deletions(-)
Signature · 1 line
1.7.7.3
PATCH 1/8 mm: use vm_unmapped_area() on parisc architecture
Update the parisc arch_get_unmapped_area function to make use of vm_unmapped_area() instead of implementing a brute force search.
--- arch/parisc/kernel/sys_parisc.c | 46 ++++++++++++++------------------------ 1 files changed, 17 insertions(+), 29 deletions(-)
arch/parisc/kernel/sys_parisc.c +17 -29
@@ -35,18 +35,15 @@static unsigned long get_unshared_area (unsigned long addr,unsigned long len) { -struct vm_area_struct *vma; +struct vm_unmapped_area_info info; - addr =PAGE_ALIGN (addr); - -for (vma =find_vma (current->mm, addr); ; vma = vma->vm_next) { -/* At this point: (!vma || addr < vma->vm_end). */ -if (TASK_SIZE - len < addr) -return -ENOMEM ; -if (!vma || addr + len <= vma->vm_start) -return addr; - addr = vma->vm_end; - } + info.flags =0 ; + info.length = len; + info.low_limit =PAGE_ALIGN (addr); + info.high_limit =TASK_SIZE ; + info.align_mask =0 ; + info.align_offset =0 ; +return vm_unmapped_area (&info); }#define DCACHE_ALIGN (addr) (((addr) + (SHMLBA - 1)) &~ (SHMLBA - 1))
@@ -63,30 +60,21 @@ static unsigned long get_unshared_area(unsigned long addr, unsigned long len)*/ static int get_offset (struct address_space *mapping) { -int offset = (unsigned long ) mapping << (PAGE_SHIFT -8 ); -return offset &0x3FF000 ; +return (unsigned long ) mapping >>8 ; }static unsigned long get_shared_area (struct address_space *mapping,unsigned long addr,unsigned long len,unsigned long pgoff) { -struct vm_area_struct *vma; -int offset = mapping ?get_offset (mapping) :0 ; - - offset = (offset + (pgoff <<PAGE_SHIFT )) &0x3FF000 ; +struct vm_unmapped_area_info info; - addr =DCACHE_ALIGN (addr - offset) + offset; - -for (vma =find_vma (current->mm, addr); ; vma = vma->vm_next) { -/* At this point: (!vma || addr < vma->vm_end). */ -if (TASK_SIZE - len < addr) -return -ENOMEM ; -if (!vma || addr + len <= vma->vm_start) -return addr; - addr =DCACHE_ALIGN (vma->vm_end - offset) + offset; -if (addr < vma->vm_end)/* handle wraparound */ -return -ENOMEM ; - } + info.flags =0 ; + info.length = len; + info.low_limit =PAGE_ALIGN (addr); + info.high_limit =TASK_SIZE ; + info.align_mask =PAGE_MASK & (SHMLBA -1 ); + info.align_offset = (get_offset (mapping) + pgoff) <<PAGE_SHIFT ; +return vm_unmapped_area (&info); } unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
Signature · 1 line
1.7.7.3
Re: [PATCH 1/8] mm: use vm_unmapped_area() on parisc architecture
Quoted 4 lines · Michel Lespinasse
Update the parisc
arch_get_unmapped_areafunction to make use ofvm_unmapped_area()instead of implementing a brute force search.Signed-off-by Michel Lespinasse <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/8 mm: use vm_unmapped_area() on alpha architecture
In reply to Michel LespinasseUpdate the alpha arch_get_unmapped_area function to make use of vm_unmapped_area() instead of implementing a brute force search.
--- arch/alpha/kernel/osf_sys.c | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-)
arch/alpha/kernel/osf_sys.c +9 -11
@@ -1298,17 +1298,15 @@ static unsigned long arch_get_unmapped_area_1(unsigned long addr, unsigned long len, unsigned long limit) { -struct vm_area_struct *vma =find_vma (current->mm, addr); - -while (1 ) { -/* At this point: (!vma || addr < vma->vm_end). */ -if (limit - len < addr) -return -ENOMEM ; -if (!vma || addr + len <= vma->vm_start) -return addr; - addr = vma->vm_end; - vma = vma->vm_next; - } +struct vm_unmapped_area_info info; + + info.flags =0 ; + info.length = len; + info.low_limit = addr; + info.high_limit = limit; + info.align_mask =0 ; + info.align_offset =0 ; +return vm_unmapped_area (&info); }unsigned long
Signature · 7 lines
1.7.7.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/8] mm: use vm_unmapped_area() on alpha architecture
Quoted 4 lines · Michel Lespinasse
Update the alpha
arch_get_unmapped_areafunction to make use ofvm_unmapped_area()instead of implementing a brute force search.Signed-off-by Michel Lespinasse <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/8] mm: use vm_unmapped_area() on alpha architecture
In reply to Michel LespinasseQuoted 4 lines · Michel Lespinasse
Update the alpha
arch_get_unmapped_areafunction to make use ofvm_unmapped_area()instead of implementing a brute force search.Signed-off-by Michel Lespinasse <[email protected]>
'Tis running fine on my alpha.
Cheers
Michael.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/8 mm: use vm_unmapped_area() on frv architecture
In reply to Michel LespinasseUpdate the frv arch_get_unmapped_area function to make use of vm_unmapped_area() instead of implementing a brute force search.
--- arch/frv/mm/elf-fdpic.c | 49 ++++++++++++++++------------------------------ 1 files changed, 17 insertions(+), 32 deletions(-)
arch/frv/mm/elf-fdpic.c +17 -32
@@ -60,7 +60,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi unsigned long pgoff, unsigned long flags) {struct vm_area_struct *vma; -unsigned long limit; +struct vm_unmapped_area_info info;if (len >TASK_SIZE )return -ENOMEM ;
@@ -79,39 +79,24 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi }/* search between the bottom of user VM and the stack grow area */ - addr =PAGE_SIZE ; - limit = (current->mm->start_stack -0x00200000 ); -if (addr + len <= limit) { - limit -= len; - -if (addr <= limit) { - vma =find_vma (current->mm,PAGE_SIZE ); -for (; vma; vma = vma->vm_next) { -if (addr > limit) -break ; -if (addr + len <= vma->vm_start) - goto success; - addr = vma->vm_end; - } - } - } + info.flags =0 ; + info.length = len; + info.low_limit =PAGE_SIZE ; + info.high_limit = (current->mm->start_stack -0x00200000 ); + info.align_mask =0 ; + info.align_offset =0 ; + addr =vm_unmapped_area (&info); +if (!(addr & ~PAGE_MASK )) + goto success; +VM_BUG_ON (addr != -ENOMEM );/* search from just above the WorkRAM area to the top of memory */ - addr =PAGE_ALIGN (0x80000000 ); - limit =TASK_SIZE - len; -if (addr <= limit) { - vma =find_vma (current->mm, addr); -for (; vma; vma = vma->vm_next) { -if (addr > limit) -break ; -if (addr + len <= vma->vm_start) - goto success; - addr = vma->vm_end; - } - -if (!vma && addr <= limit) - goto success; - } + info.low_limit =PAGE_ALIGN (0x80000000 ); + info.high_limit =TASK_SIZE ; + addr =vm_unmapped_area (&info); +if (!(addr & ~PAGE_MASK )) + goto success; +VM_BUG_ON (addr != -ENOMEM );#if 0 printk("[area] l=%lx (ENOMEM) f='%s'\n",
Signature · 7 lines
1.7.7.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 3/8] mm: use vm_unmapped_area() on frv architecture
Quoted 4 lines · Michel Lespinasse
Update the frv
arch_get_unmapped_areafunction to make use ofvm_unmapped_area()instead of implementing a brute force search.Signed-off-by Michel Lespinasse <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 4/8 mm: use vm_unmapped_area() on ia64 architecture
In reply to Michel LespinasseUpdate the ia64 arch_get_unmapped_area function to make use of vm_unmapped_area() instead of implementing a brute force search.
--- arch/ia64/kernel/sys_ia64.c | 37 ++++++++++++------------------------- 1 files changed, 12 insertions(+), 25 deletions(-)
arch/ia64/kernel/sys_ia64.c +12 -25
@@ -25,9 +25,9 @@ arch_get_unmapped_area (struct file *filp, unsigned long addr, unsigned long len unsigned long pgoff, unsigned long flags) { long map_shared = (flags & MAP_SHARED); -unsigned long start_addr, align_mask =PAGE_SIZE -1 ; +unsigned long align_mask =0 ;struct mm_struct *mm = current->mm; -struct vm_area_struct *vma; +struct vm_unmapped_area_info info;if (len >RGN_MAP_LIMIT )return -ENOMEM ;
@@ -44,7 +44,7 @@ arch_get_unmapped_area (struct file *filp, unsigned long addr, unsigned long len addr =0 ;#endif if (!addr) - addr = mm->free_area_cache; + addr =TASK_UNMAPPED_BASE ;if (map_shared && (TASK_SIZE >0xfffffffful ))/*
@@ -53,28 +53,15 @@ arch_get_unmapped_area (struct file *filp, unsigned long addr, unsigned long len* tasks, we prefer to avoid exhausting the address space too quickly by * limiting alignment to a single page. */ - align_mask =SHMLBA -1 ; - - full_search: - start_addr = addr = (addr + align_mask) & ~align_mask; - -for (vma =find_vma (mm, addr); ; vma = vma->vm_next) { -/* At this point: (!vma || addr < vma->vm_end). */ -if (TASK_SIZE - len < addr ||RGN_MAP_LIMIT - len <REGION_OFFSET (addr)) { -if (start_addr !=TASK_UNMAPPED_BASE ) { -/* Start a new search --- just in case we missed some holes. */ - addr =TASK_UNMAPPED_BASE ; - goto full_search; - } -return -ENOMEM ; - } -if (!vma || addr + len <= vma->vm_start) { -/* Remember the address where we stopped this search: */ - mm->free_area_cache = addr + len; -return addr; - } - addr = (vma->vm_end + align_mask) & ~align_mask; - } + align_mask =PAGE_MASK & (SHMLBA -1 ); + + info.flags =0 ; + info.length = len; + info.low_limit = addr; + info.high_limit =TASK_SIZE ; + info.align_mask = align_mask; + info.align_offset =0 ; +return vm_unmapped_area (&info); }asmlinkage long
Signature · 7 lines
1.7.7.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 4/8] mm: use vm_unmapped_area() on ia64 architecture
Quoted 4 lines · Michel Lespinasse
Update the ia64
arch_get_unmapped_areafunction to make use ofvm_unmapped_area()instead of implementing a brute force search.Signed-off-by Michel Lespinasse <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 5/8 mm: use vm_unmapped_area() in hugetlbfs on ia64 architecture
In reply to Michel LespinasseUpdate the ia64 hugetlb_get_unmapped_area function to make use of vm_unmapped_area() instead of implementing a brute force search.
--- arch/ia64/mm/hugetlbpage.c | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-)
arch/ia64/mm/hugetlbpage.c +9 -11
@@ -148,7 +148,7 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb,unsigned long hugetlb_get_unmapped_area (struct file *file,unsigned long addr,unsigned long len,unsigned long pgoff,unsigned long flags) { -struct vm_area_struct *vmm; +struct vm_unmapped_area_info info;if (len >RGN_MAP_LIMIT )return -ENOMEM ;
@@ -165,16 +165,14 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, u/* This code assumes that RGN_HPAGE != 0. */ if ((REGION_NUMBER (addr) !=RGN_HPAGE ) || (addr & (HPAGE_SIZE -1 ))) addr =HPAGE_REGION_BASE ; -else - addr =ALIGN (addr,HPAGE_SIZE ); -for (vmm =find_vma (current->mm, addr); ; vmm = vmm->vm_next) { -/* At this point: (!vmm || addr < vmm->vm_end). */ -if (REGION_OFFSET (addr) + len >RGN_MAP_LIMIT ) -return -ENOMEM ; -if (!vmm || (addr + len) <= vmm->vm_start) -return addr; - addr =ALIGN (vmm->vm_end,HPAGE_SIZE ); - } + + info.flags =0 ; + info.length = len; + info.low_limit = addr; + info.high_limit =HPAGE_REGION_BASE +RGN_MAP_LIMIT ; + info.align_mask =PAGE_MASK & (HPAGE_SIZE -1 ); + info.align_offset =0 ; +return vm_unmapped_area (&info); }static int __init hugetlb_setup_sz (char *str)
Signature · 7 lines
1.7.7.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 5/8] mm: use vm_unmapped_area() in hugetlbfs on ia64 architecture
Quoted 4 lines · Michel Lespinasse
Update the ia64
hugetlb_get_unmapped_areafunction to make use ofvm_unmapped_area()instead of implementing a brute force search.Signed-off-by Michel Lespinasse <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 6/8 mm: remove free_area_cache use in powerpc architecture
In reply to Michel LespinasseAs all other architectures have been converted to use vm_unmapped_area(), we are about to retire the free_area_cache.
This change simply removes the use of that cache in slice_get_unmapped_area(), which will most certainly have a performance cost. Next one will convert that function to use the vm_unmapped_area() infrastructure and regain the performance.
--- arch/powerpc/include/asm/page_64.h | 3 +- arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/mm/slice.c | 108 +++++------------------------ arch/powerpc/platforms/cell/spufs/file.c | 2 +- 4 files changed, 22 insertions(+), 93 deletions(-)
arch/powerpc/include/asm/page_64.h +1 -2
@@ -99,8 +99,7 @@ extern unsigned long slice_get_unmapped_area(unsigned long addr,unsigned long len, unsigned long flags, unsigned int psize, - int topdown, - int use_cache); + int topdown);extern unsigned int get_slice_psize (struct mm_struct *mm,unsigned long addr);
arch/powerpc/mm/hugetlbpage.c +1 -1
@@ -742,7 +742,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,struct hstate *hstate =hstate_file (file);int mmu_psize =shift_to_mmu_psize (huge_page_shift (hstate)); - return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1, 0); + return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1); }#endif
arch/powerpc/mm/slice.c +19 -89
211 lines not on this page · raw message
arch/powerpc/platforms/cell/spufs/file.c +1 -1
@@ -352,7 +352,7 @@ static unsigned long spufs_get_unmapped_area(struct file *file,/* Else, try to obtain a 64K pages slice */ return slice_get_unmapped_area (addr, len, flags, - MMU_PAGE_64K, 1, 0); + MMU_PAGE_64K, 1); }#endif /* CONFIG_SPU_FS_64K_LS */
Signature · 7 lines
1.7.7.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 6/8] mm: remove free_area_cache use in powerpc architecture
Quoted 9 lines · Michel Lespinasse
As all other architectures have been converted to use
vm_unmapped_area(), we are about to retire thefree_area_cache.This change simply removes the use of that cache in
slice_get_unmapped_area(), which will most certainly have a performance cost. Next one will convert that function to use thevm_unmapped_area()infrastructure and regain the performance.Signed-off-by Michel Lespinasse <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 7/8 mm: use vm_unmapped_area() on powerpc architecture
In reply to Michel LespinasseUpdate the powerpc slice_get_unmapped_area function to make use of vm_unmapped_area() instead of implementing a brute force search.
--- arch/powerpc/mm/slice.c | 128 +++++++++++++++++++++++++++++----------------- 1 files changed, 81 insertions(+), 47 deletions(-)
arch/powerpc/mm/slice.c +81 -47
@@ -242,31 +242,51 @@ static unsigned long slice_find_area_bottomup(struct mm_struct *mm,struct slice_mask available, int psize) { -struct vm_area_struct *vma; -unsigned long addr; -struct slice_mask mask; int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT); +unsigned long addr, found, slice; +struct vm_unmapped_area_info info; - addr =TASK_UNMAPPED_BASE ; + info.flags =0 ; + info.length = len; + info.align_mask =PAGE_MASK & ((1ul << pshift) -1 ); + info.align_offset =0 ; -for (;;) { - addr =_ALIGN_UP (addr,1ul << pshift); -if ((TASK_SIZE - len) < addr) -break ; - vma =find_vma (mm, addr); -BUG_ON (vma && (addr >= vma->vm_end)); + addr =TASK_UNMAPPED_BASE ; +while (addr <TASK_SIZE ) { + info.low_limit = addr; +if (addr <SLICE_LOW_TOP ) { + slice =GET_LOW_SLICE_INDEX (addr); + addr = (slice +1 ) <<SLICE_LOW_SHIFT ; +if (!(available.low_slices & (1u << slice))) +continue ; + }else { + slice =GET_HIGH_SLICE_INDEX (addr); + addr = (slice +1 ) <<SLICE_HIGH_SHIFT ; +if (!(available.high_slices & (1u << slice))) +continue ; + } - mask =slice_range_to_mask (addr, len); -if (!slice_check_fit (mask, available)) { -if (addr <SLICE_LOW_TOP ) - addr =_ALIGN_UP (addr +1 ,1ul <<SLICE_LOW_SHIFT ); -else - addr =_ALIGN_UP (addr +1 ,1ul <<SLICE_HIGH_SHIFT ); -continue ; + next_slice: +if (addr >=TASK_SIZE ) + addr =TASK_SIZE ; +else if (addr <SLICE_LOW_TOP ) { + slice =GET_LOW_SLICE_INDEX (addr); +if (available.low_slices & (1u << slice)) { + addr = (slice +1 ) <<SLICE_LOW_SHIFT ; + goto next_slice; + } + }else { + slice =GET_HIGH_SLICE_INDEX (addr); +if (available.high_slices & (1u << slice)) { + addr = (slice +1 ) <<SLICE_HIGH_SHIFT ; + goto next_slice; + } } -if (!vma || addr + len <= vma->vm_start) -return addr; - addr = vma->vm_end; + info.high_limit = addr; + + found =vm_unmapped_area (&info); +if (!(found & ~PAGE_MASK )) +return found; }return -ENOMEM ;
@@ -277,39 +297,53 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm,struct slice_mask available, int psize) { -struct vm_area_struct *vma; -unsigned long addr; -struct slice_mask mask; int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT); +unsigned long addr, found, slice; +struct vm_unmapped_area_info info; - addr = mm->mmap_base; -while (addr > len) { -/* Go down by chunk size */ - addr =_ALIGN_DOWN (addr - len,1ul << pshift); + info.flags =VM_UNMAPPED_AREA_TOPDOWN ; + info.length = len; + info.align_mask =PAGE_MASK & ((1ul << pshift) -1 ); + info.align_offset =0 ; -/* Check for hit with different page size */ - mask =slice_range_to_mask (addr, len); -if (!slice_check_fit (mask, available)) { -if (addr <SLICE_LOW_TOP ) - addr =_ALIGN_DOWN (addr,1ul <<SLICE_LOW_SHIFT ); -else if (addr < (1ul <<SLICE_HIGH_SHIFT )) - addr =SLICE_LOW_TOP ; -else - addr =_ALIGN_DOWN (addr,1ul <<SLICE_HIGH_SHIFT ); -continue ; + addr = mm->mmap_base; +while (addr >PAGE_SIZE ) { + info.high_limit = addr; +if (addr <SLICE_LOW_TOP ) { + slice =GET_LOW_SLICE_INDEX (addr -1 ); + addr = slice <<SLICE_LOW_SHIFT ; +if (!(available.low_slices & (1u << slice))) +continue ; + }else { + slice =GET_HIGH_SLICE_INDEX (addr -1 ); + addr = slice ? (slice <<SLICE_HIGH_SHIFT ) : +SLICE_LOW_TOP ; +if (!(available.high_slices & (1u << slice))) +continue ; } -/* -* Lookup failure means no vma is above this address, -* else if new region fits below vma->vm_start, -* return with success: -*/ - vma =find_vma (mm, addr); -if (!vma || (addr + len) <= vma->vm_start) -return addr; + next_slice: +if (addr <PAGE_SIZE ) + addr =PAGE_SIZE ; +else if (addr <SLICE_LOW_TOP ) { + slice =GET_LOW_SLICE_INDEX (addr -1 ); +if (available.low_slices & (1u << slice)) { + addr = slice <<SLICE_LOW_SHIFT ; + goto next_slice; + } + }else { + slice =GET_HIGH_SLICE_INDEX (addr -1 ); +if (available.high_slices & (1u << slice)) { + addr = slice ? (slice <<SLICE_HIGH_SHIFT ) : +SLICE_LOW_TOP ; + goto next_slice; + } + } + info.low_limit = addr; -/* try just below the current vma->vm_start */ - addr = vma->vm_start; + found =vm_unmapped_area (&info); +if (!(found & ~PAGE_MASK )) +return found; }/*
Signature · 7 lines
1.7.7.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 7/8] mm: use vm_unmapped_area() on powerpc architecture
Quoted 8 lines · Michel Lespinasse
Update the powerpc
slice_get_unmapped_areafunction to make use ofvm_unmapped_area()instead of implementing a brute force search.Signed-off-by Michel Lespinasse <[email protected]>--- arch/powerpc/mm/slice.c | 128 +++++++++++++++++++++++++++++----------------- 1 files changed, 81 insertions(+), 47 deletions(-)
That doesn't look good ... the resulting code is longer than the original, which makes me wonder how it is an improvement...
Now it could just be a matter of how the code is factored, I see quite a bit of duplication of the whole slice mask test...
Cheers,
Ben.
Quoted 147 lines
arch/powerpc/mm/slice.c +77
-45@@ -242,31 +242,51 @@ static unsigned long slice_find_area_bottomup(struct mm_struct *mm,struct slice_mask available, int psize) { -struct vm_area_struct *vma; -unsigned long addr; -struct slice_mask mask; int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT); +unsigned long addr, found, slice; +struct vm_unmapped_area_info info; - addr =TASK_UNMAPPED_BASE ; + info.flags =0 ; + info.length = len; + info.align_mask =PAGE_MASK & ((1ul << pshift) -1 ); + info.align_offset =0 ; -for (;;) { - addr =_ALIGN_UP (addr,1ul << pshift); -if ((TASK_SIZE - len) < addr) -break ; - vma =find_vma (mm, addr); -BUG_ON (vma && (addr >= vma->vm_end)); + addr =TASK_UNMAPPED_BASE ; +while (addr <TASK_SIZE ) { + info.low_limit = addr; +if (addr <SLICE_LOW_TOP ) { + slice =GET_LOW_SLICE_INDEX (addr); + addr = (slice +1 ) <<SLICE_LOW_SHIFT ; +if (!(available.low_slices & (1u << slice))) +continue ; + }else { + slice =GET_HIGH_SLICE_INDEX (addr); + addr = (slice +1 ) <<SLICE_HIGH_SHIFT ; +if (!(available.high_slices & (1u << slice))) +continue ; + } - mask =slice_range_to_mask (addr, len); -if (!slice_check_fit (mask, available)) { -if (addr <SLICE_LOW_TOP ) - addr =_ALIGN_UP (addr +1 ,1ul <<SLICE_LOW_SHIFT ); -else - addr =_ALIGN_UP (addr +1 ,1ul <<SLICE_HIGH_SHIFT ); -continue ; + next_slice: +if (addr >=TASK_SIZE ) + addr =TASK_SIZE ; +else if (addr <SLICE_LOW_TOP ) { + slice =GET_LOW_SLICE_INDEX (addr); +if (available.low_slices & (1u << slice)) { + addr = (slice +1 ) <<SLICE_LOW_SHIFT ; + goto next_slice; + } + }else { + slice =GET_HIGH_SLICE_INDEX (addr); +if (available.high_slices & (1u << slice)) { + addr = (slice +1 ) <<SLICE_HIGH_SHIFT ; + goto next_slice; + } } -if (!vma || addr + len <= vma->vm_start) -return addr; - addr = vma->vm_end; + info.high_limit = addr; + + found =vm_unmapped_area (&info); +if (!(found & ~PAGE_MASK )) +return found; }return -ENOMEM ;@@ -277,39 +297,53 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm,struct slice_mask available, int psize) { -struct vm_area_struct *vma; -unsigned long addr; -struct slice_mask mask; int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT); +unsigned long addr, found, slice; +struct vm_unmapped_area_info info; - addr = mm->mmap_base; -while (addr > len) { -/* Go down by chunk size */ - addr =_ALIGN_DOWN (addr - len,1ul << pshift); + info.flags =VM_UNMAPPED_AREA_TOPDOWN ; + info.length = len; + info.align_mask =PAGE_MASK & ((1ul << pshift) -1 ); + info.align_offset =0 ; -/* Check for hit with different page size */ - mask =slice_range_to_mask (addr, len); -if (!slice_check_fit (mask, available)) { -if (addr <SLICE_LOW_TOP ) - addr =_ALIGN_DOWN (addr,1ul <<SLICE_LOW_SHIFT ); -else if (addr < (1ul <<SLICE_HIGH_SHIFT )) - addr =SLICE_LOW_TOP ; -else - addr =_ALIGN_DOWN (addr,1ul <<SLICE_HIGH_SHIFT ); -continue ; + addr = mm->mmap_base; +while (addr >PAGE_SIZE ) { + info.high_limit = addr; +if (addr <SLICE_LOW_TOP ) { + slice =GET_LOW_SLICE_INDEX (addr -1 ); + addr = slice <<SLICE_LOW_SHIFT ; +if (!(available.low_slices & (1u << slice))) +continue ; + }else { + slice =GET_HIGH_SLICE_INDEX (addr -1 ); + addr = slice ? (slice <<SLICE_HIGH_SHIFT ) : +SLICE_LOW_TOP ; +if (!(available.high_slices & (1u << slice))) +continue ; } -/* -* Lookup failure means no vma is above this address, -* else if new region fits below vma->vm_start, -* return with success: -*/ - vma =find_vma (mm, addr); -if (!vma || (addr + len) <= vma->vm_start) -return addr; + next_slice: +if (addr <PAGE_SIZE ) + addr =PAGE_SIZE ; +else if (addr <SLICE_LOW_TOP ) { + slice =GET_LOW_SLICE_INDEX (addr -1 ); +if (available.low_slices & (1u << slice)) { + addr = slice <<SLICE_LOW_SHIFT ; + goto next_slice; + } + }else { + slice =GET_HIGH_SLICE_INDEX (addr -1 ); +if (available.high_slices & (1u << slice)) { + addr = slice ? (slice <<SLICE_HIGH_SHIFT ) : +SLICE_LOW_TOP ; + goto next_slice; + } + }
arch/powerpc/mm/slice.c static unsigned long slice_find_area_topdown(struct mm_struct *mm, · line 349
Quoted 10 lines
arch/powerpc/mm/slice.c +4
-2+ info.low_limit = addr; -/* try just below the current vma->vm_start */ - addr = vma->vm_start; + found =vm_unmapped_area (&info); +if (!(found & ~PAGE_MASK )) +return found; }/*
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 7/8] mm: use vm_unmapped_area() on powerpc architecture
Quoted 4 lines · Benjamin Herrenschmidt
Quoted 3 lines · Michel Lespinasse
Update the powerpc
slice_get_unmapped_areafunction to make use ofvm_unmapped_area()instead of implementing a brute force search.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Michel Lespinasse <[email protected]>--- arch/powerpc/mm/slice.c | 128 +++++++++++++++++++++++++++++----------------- 1 files changed, 81 insertions(+), 47 deletions(-)That doesn't look good ... the resulting code is longer than the original, which makes me wonder how it is an improvement...
Well no fair, the previous patch (for powerpc as well) has 22 insertions and 93 deletions :)
The benefit is that the new code has lower algorithmic complexity, it replaces a per-vma loop with O(N) complexity with an outer loop that finds contiguous slice blocks and passes them to vm_unmapped_area() which is only O(log N) complexity. So the new code will be faster for workloads which use lots of vmas.
That said, I do agree that the code that looks for contiguous available slices looks kinda ugly - just not sure how to make it look nicer though.
Signature · 2 lines
Michel "Walken" Lespinasse A program is never fully debugged until the last user dies.
Re: [PATCH 7/8] mm: use vm_unmapped_area() on powerpc architecture
Quoted 10 lines · Michel Lespinasse
Well no fair, the previous patch (for powerpc as well) has 22 insertions and 93 deletions :)
The benefit is that the new code has lower algorithmic complexity, it replaces a per-vma loop with O(N) complexity with an outer loop that finds contiguous slice blocks and passes them to
vm_unmapped_area()which is only O(log N) complexity. So the new code will be faster for workloads which use lots of vmas.
Quoted 3 lines
That said, I do agree that the code that looks for contiguous available slices looks kinda ugly - just not sure how to make it look nicer though.
Ok. I think at least you can move that construct:
+ if (addr < SLICE_LOW_TOP) {
+ slice = GET_LOW_SLICE_INDEX(addr);
+ addr = (slice + 1) << SLICE_LOW_SHIFT;
+ if (!(available.low_slices & (1u << slice)))
+ continue;
+ } else {
+ slice = GET_HIGH_SLICE_INDEX(addr);
+ addr = (slice + 1) << SLICE_HIGH_SHIFT;
+ if (!(available.high_slices & (1u << slice)))+ continue;
+ }
Into some kind of helper. It will probably compile to the same thing but at least it's more readable and it will avoid a fuckup in the future if somebody changes the algorithm and forgets to update one of the copies :-)
Cheers,
Ben.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 7/8] mm: use vm_unmapped_area() on powerpc architecture
Quoted 14 lines · Benjamin Herrenschmidt
Ok. I think at least you can move that construct:
(quoted diff) +11
-0+ if (addr < SLICE_LOW_TOP) { + slice = GET_LOW_SLICE_INDEX(addr); + addr = (slice + 1) << SLICE_LOW_SHIFT; + if (!(available.low_slices & (1u << slice))) + continue; + } else { + slice = GET_HIGH_SLICE_INDEX(addr); + addr = (slice + 1) << SLICE_HIGH_SHIFT; + if (!(available.high_slices & (1u << slice))) + continue; + }
Quoted 4 lines
Into some kind of helper. It will probably compile to the same thing but at least it's more readable and it will avoid a fuckup in the future if somebody changes the algorithm and forgets to update one of the copies :-)
All right, does the following look more palatable then ? (didn't re-test it, though)
--- arch/powerpc/mm/slice.c | 123 ++++++++++++++++++++++++++++++----------------- 1 files changed, 78 insertions(+), 45 deletions(-)
arch/powerpc/mm/slice.c +78 -45
@@ -237,36 +237,69 @@ static void slice_convert(struct mm_struct *mm, struct slice_mask mask, int psiz#endif } +/* +* Compute which slice addr is part of; +* set *boundary_addr to the start or end boundary of that slice +* (depending on 'end' parameter); +* return boolean indicating if the slice is marked as available in the +* 'available' slice_mark. +*/ +static bool slice_scan_available (unsigned long addr, +struct slice_mask available, +int end, +unsigned long *boundary_addr) +{ +unsigned long slice; +if (addr <SLICE_LOW_TOP ) { + slice =GET_LOW_SLICE_INDEX (addr); + *boundary_addr = (slice + end) <<SLICE_LOW_SHIFT ; +return !!(available.low_slices & (1u << slice)); + }else { + slice =GET_HIGH_SLICE_INDEX (addr); + *boundary_addr = (slice + end) ? + ((slice + end) <<SLICE_HIGH_SHIFT ) :SLICE_LOW_TOP ; +return !!(available.high_slices & (1u << slice)); + } +} +static unsigned long slice_find_area_bottomup (struct mm_struct *mm,unsigned long len,struct slice_mask available,int psize) { -struct vm_area_struct *vma; -unsigned long addr; -struct slice_mask mask;int pshift =max_t (int, mmu_psize_defs[psize].shift,PAGE_SHIFT ); +unsigned long addr, found, next_end; +struct vm_unmapped_area_info info; - addr =TASK_UNMAPPED_BASE ; - -for (;;) { - addr =_ALIGN_UP (addr,1ul << pshift); -if ((TASK_SIZE - len) < addr) -break ; - vma =find_vma (mm, addr); -BUG_ON (vma && (addr >= vma->vm_end)); + info.flags =0 ; + info.length = len; + info.align_mask =PAGE_MASK & ((1ul << pshift) -1 ); + info.align_offset =0 ; - mask =slice_range_to_mask (addr, len); -if (!slice_check_fit (mask, available)) { -if (addr <SLICE_LOW_TOP ) - addr =_ALIGN_UP (addr +1 ,1ul <<SLICE_LOW_SHIFT ); -else - addr =_ALIGN_UP (addr +1 ,1ul <<SLICE_HIGH_SHIFT ); + addr =TASK_UNMAPPED_BASE ; +while (addr <TASK_SIZE ) { + info.low_limit = addr; +if (!slice_scan_available (addr, available,1 , &addr))continue ; + + next_slice: +/* +* At this point [info.low_limit; addr) covers +* available slices only and ends at a slice boundary. +* Check if we need to reduce the range, or if we can +* extend it to cover the next available slice. +*/ +if (addr >=TASK_SIZE ) + addr =TASK_SIZE ; +else if (slice_scan_available (addr, available,1 , &next_end)) { + addr = next_end; + goto next_slice; } -if (!vma || addr + len <= vma->vm_start) -return addr; - addr = vma->vm_end; + info.high_limit = addr; + + found =vm_unmapped_area (&info); +if (!(found & ~PAGE_MASK )) +return found; }return -ENOMEM ;
@@ -277,39 +310,39 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm,struct slice_mask available, int psize) { -struct vm_area_struct *vma; -unsigned long addr; -struct slice_mask mask; int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT); +unsigned long addr, found, prev; +struct vm_unmapped_area_info info; - addr = mm->mmap_base; -while (addr > len) { -/* Go down by chunk size */ - addr =_ALIGN_DOWN (addr - len,1ul << pshift); + info.flags =VM_UNMAPPED_AREA_TOPDOWN ; + info.length = len; + info.align_mask =PAGE_MASK & ((1ul << pshift) -1 ); + info.align_offset =0 ; -/* Check for hit with different page size */ - mask =slice_range_to_mask (addr, len); -if (!slice_check_fit (mask, available)) { -if (addr <SLICE_LOW_TOP ) - addr =_ALIGN_DOWN (addr,1ul <<SLICE_LOW_SHIFT ); -else if (addr < (1ul <<SLICE_HIGH_SHIFT )) - addr =SLICE_LOW_TOP ; -else - addr =_ALIGN_DOWN (addr,1ul <<SLICE_HIGH_SHIFT ); + addr = mm->mmap_base; +while (addr >PAGE_SIZE ) { + info.high_limit = addr; +if (!slice_scan_available (addr -1 , available,0 , &addr))continue ; - } + prev_slice:/* -* Lookup failure means no vma is above this address, -* else if new region fits below vma->vm_start, -* return with success: +* At this point [addr; info.high_limit) covers +* available slices only and starts at a slice boundary. +* Check if we need to reduce the range, or if we can +* extend it to cover the previous available slice. */ - vma =find_vma (mm, addr); -if (!vma || (addr + len) <= vma->vm_start) -return addr; +if (addr <PAGE_SIZE ) + addr =PAGE_SIZE ; +else if (slice_scan_available (addr -1 , available,0 , &prev)) { + addr = prev; + goto prev_slice; + } + info.low_limit = addr; -/* try just below the current vma->vm_start */ - addr = vma->vm_start; + found =vm_unmapped_area (&info); +if (!(found & ~PAGE_MASK )) +return found; }/*
Signature · 8 lines
Michel "Walken" Lespinasse A program is never fully debugged until the last user dies. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Rik van Riel
Acked-byRe: [PATCH 7/8] mm: use vm_unmapped_area() on powerpc architecture
Quoted 15 lines · Michel Lespinasse
Quoted 14 lines · Benjamin Herrenschmidt
Ok. I think at least you can move that construct:
(quoted diff) +11
-0+ if (addr < SLICE_LOW_TOP) { + slice = GET_LOW_SLICE_INDEX(addr); + addr = (slice + 1) << SLICE_LOW_SHIFT; + if (!(available.low_slices & (1u << slice))) + continue; + } else { + slice = GET_HIGH_SLICE_INDEX(addr); + addr = (slice + 1) << SLICE_HIGH_SHIFT; + if (!(available.high_slices & (1u << slice))) + continue; + }
Quoted 7 lines
Quoted 4 lines
Into some kind of helper. It will probably compile to the same thing but at least it's more readable and it will avoid a fuckup in the future if somebody changes the algorithm and forgets to update one of the copies :-)
All right, does the following look more palatable then ? (didn't re-test it, though)
Looks equivalent. I have also not tested :)
Quoted 1 line
Signed-off-by Michel Lespinasse <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 7/8] mm: use vm_unmapped_area() on powerpc architecture
In reply to Michel LespinasseQuoted 4 lines · Michel Lespinasse
Update the powerpc
slice_get_unmapped_areafunction to make use ofvm_unmapped_area()instead of implementing a brute force search.Signed-off-by Michel Lespinasse <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 8/8 mm: remove free_area_cache
In reply to Michel LespinasseSince all architectures have been converted to use vm_unmapped_area(), there is no remaining use for the free_area_cache.
--- arch/arm/mm/mmap.c | 2 -- arch/arm64/mm/mmap.c | 2 -- arch/mips/mm/mmap.c | 2 -- arch/powerpc/mm/mmap_64.c | 2 -- arch/s390/mm/mmap.c | 4 ---- arch/sparc/kernel/sys_sparc_64.c | 2 -- arch/tile/mm/mmap.c | 2 -- arch/x86/ia32/ia32_aout.c | 2 -- arch/x86/mm/mmap.c | 2 -- fs/binfmt_aout.c | 2 -- fs/binfmt_elf.c | 2 -- include/linux/mm_types.h | 3 --- include/linux/sched.h | 2 -- kernel/fork.c | 4 ---- mm/mmap.c | 28 ---------------------------- mm/nommu.c | 4 ---- mm/util.c | 1 - 17 files changed, 0 insertions(+), 66 deletions(-)
arch/arm/mm/mmap.c +0 -2
@@ -181,11 +181,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm)if (mmap_is_legacy ()) { mm->mmap_base =TASK_UNMAPPED_BASE + random_factor; mm->get_unmapped_area = arch_get_unmapped_area; - mm->unmap_area = arch_unmap_area; }else { mm->mmap_base =mmap_base (random_factor); mm->get_unmapped_area = arch_get_unmapped_area_topdown; - mm->unmap_area = arch_unmap_area_topdown; } }
arch/arm64/mm/mmap.c +0 -2
@@ -90,11 +90,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm)if (mmap_is_legacy ()) { mm->mmap_base =TASK_UNMAPPED_BASE ; mm->get_unmapped_area = arch_get_unmapped_area; - mm->unmap_area = arch_unmap_area; }else { mm->mmap_base =mmap_base (); mm->get_unmapped_area = arch_get_unmapped_area_topdown; - mm->unmap_area = arch_unmap_area_topdown; } }EXPORT_SYMBOL_GPL (arch_pick_mmap_layout);
arch/mips/mm/mmap.c +0 -2
@@ -158,11 +158,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm)if (mmap_is_legacy ()) { mm->mmap_base =TASK_UNMAPPED_BASE + random_factor; mm->get_unmapped_area = arch_get_unmapped_area; - mm->unmap_area = arch_unmap_area; }else { mm->mmap_base =mmap_base (random_factor); mm->get_unmapped_area = arch_get_unmapped_area_topdown; - mm->unmap_area = arch_unmap_area_topdown; } }
arch/powerpc/mm/mmap_64.c +0 -2
@@ -92,10 +92,8 @@ void arch_pick_mmap_layout(struct mm_struct *mm)if (mmap_is_legacy ()) { mm->mmap_base =TASK_UNMAPPED_BASE ; mm->get_unmapped_area = arch_get_unmapped_area; - mm->unmap_area = arch_unmap_area; }else { mm->mmap_base =mmap_base (); mm->get_unmapped_area = arch_get_unmapped_area_topdown; - mm->unmap_area = arch_unmap_area_topdown; } }
arch/s390/mm/mmap.c +0 -4
@@ -91,11 +91,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm)if (mmap_is_legacy ()) { mm->mmap_base =TASK_UNMAPPED_BASE ; mm->get_unmapped_area = arch_get_unmapped_area; - mm->unmap_area = arch_unmap_area; }else { mm->mmap_base =mmap_base (); mm->get_unmapped_area = arch_get_unmapped_area_topdown; - mm->unmap_area = arch_unmap_area_topdown; } }
@@ -173,11 +171,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm)if (mmap_is_legacy ()) { mm->mmap_base =TASK_UNMAPPED_BASE ; mm->get_unmapped_area = s390_get_unmapped_area; - mm->unmap_area = arch_unmap_area; }else { mm->mmap_base =mmap_base (); mm->get_unmapped_area = s390_get_unmapped_area_topdown; - mm->unmap_area = arch_unmap_area_topdown; } }
arch/sparc/kernel/sys_sparc_64.c +0 -2
@@ -290,7 +290,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm) sysctl_legacy_va_layout) { mm->mmap_base = TASK_UNMAPPED_BASE + random_factor; mm->get_unmapped_area = arch_get_unmapped_area; - mm->unmap_area = arch_unmap_area; } else {/* We know it's 32-bit */ unsigned long task_size =STACK_TOP32 ;
@@ -302,7 +301,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm) mm->mmap_base =PAGE_ALIGN (task_size - gap - random_factor); mm->get_unmapped_area = arch_get_unmapped_area_topdown; - mm->unmap_area = arch_unmap_area_topdown; } }
arch/tile/mm/mmap.c +0 -2
@@ -66,10 +66,8 @@ void arch_pick_mmap_layout(struct mm_struct *mm)if (!is_32bit ||rlimit (RLIMIT_STACK ) ==RLIM_INFINITY ) { mm->mmap_base =TASK_UNMAPPED_BASE ; mm->get_unmapped_area = arch_get_unmapped_area; - mm->unmap_area = arch_unmap_area; }else { mm->mmap_base =mmap_base (mm); mm->get_unmapped_area = arch_get_unmapped_area_topdown; - mm->unmap_area = arch_unmap_area_topdown; } }
arch/x86/ia32/ia32_aout.c +0 -2
@@ -309,8 +309,6 @@ static int load_aout_binary(struct linux_binprm *bprm) (current->mm->start_data =N_DATADDR (ex)); current->mm->brk = ex.a_bss + (current->mm->start_brk =N_BSSADDR (ex)); - current->mm->free_area_cache =TASK_UNMAPPED_BASE ; - current->mm->cached_hole_size =0 ; retval =setup_arg_pages (bprm,IA32_STACK_TOP ,EXSTACK_DEFAULT );if (retval <0 ) {
arch/x86/mm/mmap.c +0 -2
@@ -115,10 +115,8 @@ void arch_pick_mmap_layout(struct mm_struct *mm)if (mmap_is_legacy ()) { mm->mmap_base =mmap_legacy_base (); mm->get_unmapped_area = arch_get_unmapped_area; - mm->unmap_area = arch_unmap_area; }else { mm->mmap_base =mmap_base (); mm->get_unmapped_area = arch_get_unmapped_area_topdown; - mm->unmap_area = arch_unmap_area_topdown; } }
fs/binfmt_aout.c +0 -2
@@ -256,8 +256,6 @@ static int load_aout_binary(struct linux_binprm * bprm) (current->mm->start_data =N_DATADDR (ex)); current->mm->brk = ex.a_bss + (current->mm->start_brk =N_BSSADDR (ex)); - current->mm->free_area_cache = current->mm->mmap_base; - current->mm->cached_hole_size =0 ; retval =setup_arg_pages (bprm,STACK_TOP ,EXSTACK_DEFAULT );if (retval <0 ) {
fs/binfmt_elf.c +0 -2
@@ -730,8 +730,6 @@ static int load_elf_binary(struct linux_binprm *bprm)/* Do this so that we can load the interpreter, if need be. We will change some of these later */ - current->mm->free_area_cache = current->mm->mmap_base; - current->mm->cached_hole_size =0 ; retval =setup_arg_pages (bprm,randomize_stack_top (STACK_TOP ), executable_stack);if (retval <0 ) {
include/linux/mm_types.h +0 -3
@@ -329,12 +329,9 @@ struct mm_struct {unsigned long (*get_unmapped_area) (struct file *filp,unsigned long addr,unsigned long len,unsigned long pgoff,unsigned long flags); -void (*unmap_area) (struct mm_struct *mm,unsigned long addr);#endif unsigned long mmap_base;/* base of mmap area */ unsigned long task_size;/* size of task vm space */ -unsigned long cached_hole_size;/* if non-zero, the largest hole below free_area_cache */ -unsigned long free_area_cache;/* first hole of size cached_hole_size or larger */ unsigned long highest_vm_end;/* highest vma end address */ pgd_t * pgd;atomic_t mm_users;/* How many users with user space? */
include/linux/sched.h +0 -2
@@ -366,8 +366,6 @@ extern unsigned long arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); -extern void arch_unmap_area (struct mm_struct *,unsigned long ); -extern void arch_unmap_area_topdown (struct mm_struct *,unsigned long );#else static inline void arch_pick_mmap_layout (struct mm_struct *mm) {}#endif
kernel/fork.c +0 -4
@@ -364,8 +364,6 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) mm->locked_vm =0 ; mm->mmap =NULL ; mm->mmap_cache =NULL ; - mm->free_area_cache = oldmm->mmap_base; - mm->cached_hole_size = ~0UL ; mm->map_count =0 ;cpumask_clear (mm_cpumask (mm)); mm->mm_rb =RB_ROOT ;
@@ -539,8 +537,6 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p) mm->nr_ptes =0 ;memset (&mm->rss_stat,0 ,sizeof (mm->rss_stat));spin_lock_init (&mm->page_table_lock); - mm->free_area_cache =TASK_UNMAPPED_BASE ; - mm->cached_hole_size = ~0UL ;mm_init_aio (mm);mm_init_owner (mm, p);
mm/mmap.c +0 -28
@@ -1800,15 +1800,6 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, }#endif -void arch_unmap_area(struct mm_struct *mm, unsigned long addr) -{ -/* -* Is this a new hole at the lowest possible address? -*/ -if (addr >=TASK_UNMAPPED_BASE && addr < mm->free_area_cache) - mm->free_area_cache = addr; -} -/* * This mmap-allocator allocates new areas top-down from below the * stack's low limit (the base):
@@ -1865,19 +1856,6 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, }#endif -void arch_unmap_area_topdown (struct mm_struct *mm,unsigned long addr) -{ -/* -* Is this a new hole at the highest possible address? -*/ -if (addr > mm->free_area_cache) - mm->free_area_cache = addr; - -/* dont allow allocations above current base */ -if (mm->free_area_cache > mm->mmap_base) - mm->free_area_cache = mm->mmap_base; -} -unsigned long get_unmapped_area (struct file *file,unsigned long addr,unsigned long len,unsigned long pgoff,unsigned long flags)
@@ -2276,7 +2254,6 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, {struct vm_area_struct **insertion_point;struct vm_area_struct *tail_vma =NULL ; -unsigned long addr; insertion_point = (prev ? &prev->vm_next : &mm->mmap); vma->vm_prev =NULL ;
@@ -2293,11 +2270,6 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, }else mm->highest_vm_end = prev ? prev->vm_end :0 ; tail_vma->vm_next =NULL ; -if (mm->unmap_area == arch_unmap_area) - addr = prev ? prev->vm_end : mm->mmap_base; -else - addr = vma ? vma->vm_start : mm->mmap_base; - mm->unmap_area (mm, addr); mm->mmap_cache =NULL ;/* Kill the cache. */ }
mm/nommu.c +0 -4
@@ -1852,10 +1852,6 @@ unsigned long arch_get_unmapped_area(struct file *file, unsigned long addr,return -ENOMEM ; } -void arch_unmap_area (struct mm_struct *mm,unsigned long addr) -{ -} -void unmap_mapping_range (struct address_space *mapping,loff_t const holebegin,loff_t const holelen,int even_cows)
mm/util.c +0 -1
@@ -293,7 +293,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm) { mm->mmap_base =TASK_UNMAPPED_BASE ; mm->get_unmapped_area = arch_get_unmapped_area; - mm->unmap_area = arch_unmap_area; }#endif
Signature · 7 lines
1.7.7.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 8/8] mm: remove free_area_cache
Quoted 4 lines · Michel Lespinasse
Since all architectures have been converted to use
vm_unmapped_area(), there is no remaining use for thefree_area_cache.Signed-off-by Michel Lespinasse <[email protected]>
Yay
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Whoops, I was supposed to find a more appropriate subject line before sending this :]
Quoted 3 lines · Michel Lespinasse
These patches, which apply on top of v3.8-rc kernels, are to complete the VMA gap finding code I introduced (following Rik's initial proposal) in v3.8-rc1.
Signature · 8 lines
Michel "Walken" Lespinasse A program is never fully debugged until the last user dies. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>