mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 15:15:47 +00:00
mm: use vm_unmapped_area() on sparc32 architecture
Update the sparc32 arch_get_unmapped_area function to make use of vm_unmapped_area() instead of implementing a brute force search. [akpm@linux-foundation.org: fix build] [akpm@linux-foundation.org: remove now-unused COLOUR_ALIGN()] Signed-off-by: Michel Lespinasse <walken@google.com> Reviewed-by: Rik van Riel <riel@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Paul Mundt <lethal@linux-sh.org> Acked-by: "David S. Miller" <davem@davemloft.net> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b4265f1234
commit
a046be3d3c
1 changed files with 9 additions and 18 deletions
|
@ -34,11 +34,9 @@ asmlinkage unsigned long sys_getpagesize(void)
|
||||||
return PAGE_SIZE; /* Possibly older binaries want 8192 on sun4's? */
|
return PAGE_SIZE; /* Possibly older binaries want 8192 on sun4's? */
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COLOUR_ALIGN(addr) (((addr)+SHMLBA-1)&~(SHMLBA-1))
|
|
||||||
|
|
||||||
unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags)
|
unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags)
|
||||||
{
|
{
|
||||||
struct vm_area_struct * vmm;
|
struct vm_unmapped_area_info info;
|
||||||
|
|
||||||
if (flags & MAP_FIXED) {
|
if (flags & MAP_FIXED) {
|
||||||
/* We do not accept a shared mapping if it would violate
|
/* We do not accept a shared mapping if it would violate
|
||||||
|
@ -56,21 +54,14 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
|
||||||
if (!addr)
|
if (!addr)
|
||||||
addr = TASK_UNMAPPED_BASE;
|
addr = TASK_UNMAPPED_BASE;
|
||||||
|
|
||||||
if (flags & MAP_SHARED)
|
info.flags = 0;
|
||||||
addr = COLOUR_ALIGN(addr);
|
info.length = len;
|
||||||
else
|
info.low_limit = addr;
|
||||||
addr = PAGE_ALIGN(addr);
|
info.high_limit = TASK_SIZE;
|
||||||
|
info.align_mask = (flags & MAP_SHARED) ?
|
||||||
for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) {
|
(PAGE_MASK & (SHMLBA - 1)) : 0;
|
||||||
/* At this point: (!vmm || addr < vmm->vm_end). */
|
info.align_offset = pgoff << PAGE_SHIFT;
|
||||||
if (TASK_SIZE - PAGE_SIZE - len < addr)
|
return vm_unmapped_area(&info);
|
||||||
return -ENOMEM;
|
|
||||||
if (!vmm || addr + len <= vmm->vm_start)
|
|
||||||
return addr;
|
|
||||||
addr = vmm->vm_end;
|
|
||||||
if (flags & MAP_SHARED)
|
|
||||||
addr = COLOUR_ALIGN(addr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue