From patchwork Wed Jan 9 01:28:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 1950221 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id B6931DFABD for ; Wed, 9 Jan 2013 01:29:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756389Ab3AIB2f (ORCPT ); Tue, 8 Jan 2013 20:28:35 -0500 Received: from mail-da0-f46.google.com ([209.85.210.46]:38871 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756324Ab3AIB2c (ORCPT ); Tue, 8 Jan 2013 20:28:32 -0500 Received: by mail-da0-f46.google.com with SMTP id p5so466513dak.19 for ; Tue, 08 Jan 2013 17:28:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=X/fqiYxeGhEl06mlYA6GxTFnIGMeNLRlgZN+4rCnRDw=; b=Q0QHo2ucT24vJKQu3pFZxSOy6qXjdph6zZlRUrAJI1Lv/XFlKK/Ry5wZ1rGZgHE25e l2XR6ZoEnj2iArHX1qDt/NWDBVc/CZ5a1ZGza0/YsjICF5jkPi9Izl6boLshztnHKlw3 8JT9zYHIuCmr5C4tVCQKcrMAV+udRASa3IV1gZTax1V29F8ng1XltnnblnA0IA36txI1 9nx6zXqCw953mU8X+EHS6tgrgkzeI4/SW4ZjnDODcJ0uBD21zSJR+2NvymLVrxqC8Jlj CzDsXUJIY606KIF+J16t6CPAEdrGs/814VD0X9XclQNYVgyoWu7SP74xzADuMmljaPai CvPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=X/fqiYxeGhEl06mlYA6GxTFnIGMeNLRlgZN+4rCnRDw=; b=bEGmun8fhFpqJKa+mth+lCX1LJLR+DT1uYIKx6QkcaQ+Loc4F+3LJEUXgphNUaBT34 PaVmqnQ1nMDUNBZJQHcQc7NUC3IkKYr2VZDAF9lA+9aLMtu12GOLtIRQvn3IyCh25KR9 L/nu6UsoVi1O2/HDHSEGMpeWuv/cVy+tYStQq4nawa3c4ZS6Mi1amNuuj+yU30TgGJAb MTxKa1UeQOlUY9EKnGNklquC0rRIQYsa97DrAR8lGsTpI0ZRlu/P//Lr9ucGW7X10Pae 9evY4TTV3E6DCt+HeiuzFOsnccpGTak9pXKPJOFzOMKRP0G7RvV7yCsx7qgKT3GiPg5N xBdQ== X-Received: by 10.68.227.33 with SMTP id rx1mr163657410pbc.67.1357694912431; Tue, 08 Jan 2013 17:28:32 -0800 (PST) Received: from studio.mtv.corp.google.com (studio.mtv.corp.google.com [172.17.131.106]) by mx.google.com with ESMTPS id p10sm41711168pax.27.2013.01.08.17.28.30 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 17:28:31 -0800 (PST) From: Michel Lespinasse To: Rik van Riel , Benjamin Herrenschmidt , "James E.J. Bottomley" , Matt Turner , David Howells , Tony Luck Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-parisc@vger.kernel.org, linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org Subject: [PATCH 3/8] mm: use vm_unmapped_area() on frv architecture Date: Tue, 8 Jan 2013 17:28:10 -0800 Message-Id: <1357694895-520-4-git-send-email-walken@google.com> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1357694895-520-1-git-send-email-walken@google.com> References: <1357694895-520-1-git-send-email-walken@google.com> X-Gm-Message-State: ALoCoQnPVYRgFY4Ak6JtjatMX8PCHrS/s5n49eEZVXYgdbyeTsPdNCy2k49lDSdRJmF2V4sOB//CEI2r4So035Uj2l2AIt5797AuduviDIrABMVb/lm81rlX2kv8WQEhM63HADJu+/VwoDRWngdYdn+Y/EMv4ng13Qjjvcd4mgJRfJL5Ooa8vB3gzaaU6SV60iCaEHUwRzNTnSV5Ehw23PwZthKOo7QPHw== Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org Update the frv arch_get_unmapped_area function to make use of vm_unmapped_area() instead of implementing a brute force search. Signed-off-by: Michel Lespinasse Acked-by: Rik van Riel --- arch/frv/mm/elf-fdpic.c | 49 ++++++++++++++++------------------------------ 1 files changed, 17 insertions(+), 32 deletions(-) diff --git a/arch/frv/mm/elf-fdpic.c b/arch/frv/mm/elf-fdpic.c index 385fd30b142f..836f14707a62 100644 --- a/arch/frv/mm/elf-fdpic.c +++ b/arch/frv/mm/elf-fdpic.c @@ -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",