From patchwork Thu Jan 24 01:29:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 2027561 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 314333FD86 for ; Thu, 24 Jan 2013 01:31:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753165Ab3AXBbq (ORCPT ); Wed, 23 Jan 2013 20:31:46 -0500 Received: from mail-pb0-f47.google.com ([209.85.160.47]:43176 "EHLO mail-pb0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753194Ab3AXBaD (ORCPT ); Wed, 23 Jan 2013 20:30:03 -0500 Received: by mail-pb0-f47.google.com with SMTP id wz17so5066615pbc.34 for ; Wed, 23 Jan 2013 17:30:02 -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=dBfKPX7n7lb9jyBikQVC5yCeUpFdBWUlaq9WPqlMBjw=; b=CpNjMGcU0vf/+Ce1ReSUHArwgvzMD/K+K3EuNonxf3jKoHfX6xf+Ju5agen156wntX 8H6GmMlymr67YNP4yJB7HB82JvGKLxsZTJ/eyNKVoF110XF88LFFUe4GG7Htn2oWP5z3 EH19LcX2W/8cuFEwalADgoF9cgUblHKdbxpnFK166m9l3d+KnvduQU6p+BF5kamg1mp3 LVavOETq2dp8N+lxtkdOoRGmUcNUhhWQx6N9Myiz05U9aHpvhbCOP/Q/fzGLSL04/o8g vrSidOQEsVHKhom4TCJzofMyFsrNiVkXM66ZCGz3sn3jJNsUMbaoHsh4D9BXKSoibyiq Pxxw== 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=dBfKPX7n7lb9jyBikQVC5yCeUpFdBWUlaq9WPqlMBjw=; b=QYBTfsntoZVs73uMYuvJqcOBnJ4zHgw3PZpwNfx098uKThp24EnKc0GUQMHlV1OwM4 q8uj4HNHGo15vjzzC08vO5drP7iKoJc+HzF6y5jUI4QKoobmfY5TegiZ3nreAE7NHKLq tCLJ/Oa9EnNamb4oOk9pP36kECvJd2x0VFRghamGQEdEn381iFCvD0uEyFKv/iHU/z9e Uln0Zls7b8wC/4KW7kK1uhl75IhBzBK94tnKWc550l7Da24n+IckoftKYEvjNMHu2fxh oSEZSor9xBfyebyafuS4dUZbckjEJ092wgQTkoT4Lvxx5pZct3bdsq/UxjMf6M9OB7qo QC+Q== X-Received: by 10.68.132.98 with SMTP id ot2mr606433pbb.39.1358991002836; Wed, 23 Jan 2013 17:30:02 -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 kc4sm13786285pbc.23.2013.01.23.17.30.01 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Jan 2013 17:30:02 -0800 (PST) From: Michel Lespinasse To: Benjamin Herrenschmidt , Paul Mackerras , "James E.J. Bottomley" , Helge Deller , Richard Henderson , Ivan Kokshaysky , Matt Turner , David Howells , Tony Luck , Fenghua Yu 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: Wed, 23 Jan 2013 17:29:46 -0800 Message-Id: <1358990991-21316-4-git-send-email-walken@google.com> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1358990991-21316-1-git-send-email-walken@google.com> References: <1358990991-21316-1-git-send-email-walken@google.com> X-Gm-Message-State: ALoCoQlzIPl3Y2+Hw+smBC6JGNszumG80Ba1RxaPitciuxDegSxTEWDkNfB+h4P4bJjg0Aa1cc7QpBAE9RnY2kPyTmlfmKYnHMpw3FY8BALLZHchJCfdNFpdj5QF6NxYF1VStDTjdXCOe/gTC+/xKWtebHqD39EHbCrOxu9uls2e+Xbc36o6A+sfSctqYdMznJNHp3iqYZMRU61p8x2wluwhM4pZ/yBqeg== 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 Acked-by: David Howells --- 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",