From patchwork Wed Jan 9 01:28:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 1950231 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 9DB9C3FED4 for ; Wed, 9 Jan 2013 01:29:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756341Ab3AIB3q (ORCPT ); Tue, 8 Jan 2013 20:29:46 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:32832 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756316Ab3AIB2e (ORCPT ); Tue, 8 Jan 2013 20:28:34 -0500 Received: by mail-pa0-f50.google.com with SMTP id hz10so680399pad.37 for ; Tue, 08 Jan 2013 17:28:34 -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=rmX0kPlia+PUaoIgdgKV+zd7+Z+psdbVLfo8bOitlVc=; b=Xegap4c+J0mP5khwwaHVzEe7tl1JGJ4Etb1YPnkSYA/RirKFycaAkrQzusm0xZewfC b2ikqSuSFZ4qOFzfDhu6hHAxfrycVUxRsGjxFuyppN8jVIR7Lhx+HUCZhhnW6FA9ES9B z42oJPTCqaU+p1lpO7lvA17lySQITPoC8mfXGs1boyeJ6XUSFL6/hcwzlYwS1+7mlRmp nUkFglbhfhyLQLLdZJDtjwl5cQmwiyfVTFW5WruiT4T1qYSL/L7IMtElxb1hK/oflDKm mjSZrDtaBksaCuUdFGXcACtMkuAcJSoKf/Yu9EM2Vr07JwGvCKdKctiAlg1YQJffC7yE MsVA== 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=rmX0kPlia+PUaoIgdgKV+zd7+Z+psdbVLfo8bOitlVc=; b=BMoJ53EF2V3L1CQEKXUVgyk5E+do88Jruxj7RVG8lA6HwdFginwkPVyREBp5QUXxQ+ Ksy3bp8AjBuCphr4XZ/55r53TAwOWmw979luZ5Sq/++w+ygbviKnBbCev4gJAReuEFVW oW7wzaZiOSRrfTIVB7NmJFRzKVTBIet0TN+dkt/p75ICN3AGH4bN594k9J2zpyp4xXI/ HeAuv+Dtg80wwMDvhri5mjU1h1Plb8Oles2WBqtuu9/xaxCVhpKhc1Zyr4OSXVS3PWwF ibibMYdW5rMOl8Ho+IbU8XzNPkEuc57j/LYeHGT43oRQ3PdM3erHe9xCWoyj0CzmMM+2 Q0Jg== X-Received: by 10.68.238.39 with SMTP id vh7mr29804512pbc.6.1357694914019; Tue, 08 Jan 2013 17:28:34 -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.32 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 17:28:33 -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 4/8] mm: use vm_unmapped_area() on ia64 architecture Date: Tue, 8 Jan 2013 17:28:11 -0800 Message-Id: <1357694895-520-5-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: ALoCoQm2KCoTC7zN4+wnch1SV43gDHhgPSNBqEODZ97IeQR295xW7qFmZ6N0D9It+SyPSu9k/btWe+MKoaRnkHeWSNFfEvXb45eLfr/zHGDBeeUZx4DbP71pB563EVztAMCctlp+qWG7TWd84oHh+wsXhdyX6LkQFgg6oIOqui7dKskhhZsFZ2EU6+vNeScugRPVNKpQIGgG94xzzRwvunTaDhCDcZB9uw== 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