From patchwork Thu Jan 24 01:29:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 2027611 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 2AFE23FD1A for ; Thu, 24 Jan 2013 01:32:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752241Ab3AXBbj (ORCPT ); Wed, 23 Jan 2013 20:31:39 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:45070 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752758Ab3AXBaG (ORCPT ); Wed, 23 Jan 2013 20:30:06 -0500 Received: by mail-pa0-f44.google.com with SMTP id hz11so5172933pad.17 for ; Wed, 23 Jan 2013 17:30:04 -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=5L+q0Y9KISfowVv0lJzr70QDTropEW1M4GnG3qLW9Lk=; b=ejBEz/Jp9jwrVR+q2Xqp+/gcb3yxUa8FFifhDrv9LehV/kB1GWLEfCAqxPgNw1rbRO AStMhpuUz4x56ZajJRag1jPGkcWJndbB6VRE3UPU2NXze8OIPMoYrHaCHrd51RJisb+X 7vfINceJiqR1eHVXgShcs1W3Hn4SdArJTp5/6sGxG14fVREc6DJbJrPYXePnc5rOW8Hn cRres5ieTE413p+Z6pgMAzaMC993zgKss5EvqLtsQ/xOnTugOG+0PTNjfon2qaz0Daoc +1CAyfcAWRjTGupNOLZAgioMkIytholw5WkVsw00nOd8JFBo19hAxHDMwnNW6lzwDrgv BEew== 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=5L+q0Y9KISfowVv0lJzr70QDTropEW1M4GnG3qLW9Lk=; b=mb+yVAebebAHzt/0nrNjIATrmOZNKVjNEp4WSOAWmvFOOORdHCwAU8qC5Yeg14vQ/J rIdxznaP8V5qahfMulnIDH2MpQKtxwak2BfMCna3JUcoIRNGhDSGe9pJeYuQ91nhUiW2 nJvhvArVE7Xw3soWsUniEYbC9ryIptQKGGwtIV1T9C/fu+fo/RZJfvAISyJTT+l9mwmU UMMP51vV7xBUtux36M/GnOKFeRRg2KuSWfBViSCPT1k58PjwvKKquq4LO9zFv1QI7Tg4 xuHnk/vDgn6hzQ/D9TSV7QG1re9WThSJL3c+ILS141Eu4zOCM5gze/g4RFvLU0tn4V4e Ymcg== X-Received: by 10.66.79.97 with SMTP id i1mr504350pax.47.1358991004574; Wed, 23 Jan 2013 17:30:04 -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.02 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Jan 2013 17:30:03 -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 4/8] mm: use vm_unmapped_area() on ia64 architecture Date: Wed, 23 Jan 2013 17:29:47 -0800 Message-Id: <1358990991-21316-5-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: ALoCoQn7bWMSJAfsWsyCyDt1YZiMoemUD3XlqDKwV8BFN0aeRMH4K2YFmNb7cDTcen5SpRlSrHeIJdYUiO5kXSod4bXbp+YE1bEP+6uOgMczLK42OeKXmWsy7XNKH8/h6kwH9QPxa1vYBPMKYdP087E3egYGiWpHysgzjDvgRb9CpcLJRlvKe7/NwQ9YWpc2qfVNiOR1JDEZHS0cYkFjQwRqS4MJBy1q1A== Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org Update the ia64 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/ia64/kernel/sys_ia64.c | 37 ++++++++++++------------------------- 1 files changed, 12 insertions(+), 25 deletions(-) diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c index d9439ef2f661..41e33f84c185 100644 --- a/arch/ia64/kernel/sys_ia64.c +++ b/arch/ia64/kernel/sys_ia64.c @@ -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