From patchwork Wed Jan 9 01:28:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 1950191 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 A01FEDF23A for ; Wed, 9 Jan 2013 01:29:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756429Ab3AIB2k (ORCPT ); Tue, 8 Jan 2013 20:28:40 -0500 Received: from mail-pb0-f48.google.com ([209.85.160.48]:52971 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756430Ab3AIB2h (ORCPT ); Tue, 8 Jan 2013 20:28:37 -0500 Received: by mail-pb0-f48.google.com with SMTP id rq13so596445pbb.35 for ; Tue, 08 Jan 2013 17:28:35 -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=Ot6SwVzFhpkOj27D0aUl6IlzVtpVuXdWJY2PyhFFCe8=; b=QaZJDOPDz6bKZACJzx+ZkJ+WmxqqeSahygpSepnbLlbIlrJ0Y3ay+T1obw0sbzxQNf 0+G/J4Kmh3+1IJC4hQB61yEeF9JJBk1MX+XG0VD7G0bzaW+yhsWz/O8gUZLtzKchKN/W vqSWRFZ+KwrNFVB6BgJeFilF0G46iHvukYZ0xLZUUIpR5Gd98Yz9doWwCDdLM3CqYkti vybpSUEZTfTnJeLaC6BHduXJlSPiTvrbavsKPD7f1io1mmN+Ro6ElPKqHfH7UBW9XTbz VaOST4/WElCbEC1UHVonEYC0oXOqptvZAAZY6LE+8vqt+M4eFQkW4lsxhx8ZyrMcwCtj MnQg== 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=Ot6SwVzFhpkOj27D0aUl6IlzVtpVuXdWJY2PyhFFCe8=; b=aqAeJKoQS4daHCXs2yC5R/hxeBFoTRPsMTqbe/JHuncmWiQ5szhzEJY6hflVDWnZQD mA6jivFflzhLrLaMInGQxnwFi83MmV2LNhHKycU8DwtSUAeB/h83vA+JOwBr64FmPrXq ffQ7o1/qDpO6Bb13oUFnHnjYmuCo4TcTkgErgF1CPVCgUVvqLEKWJZE2yyHpMAK3b2Qf hy+8RTHKoM31fEVKpRZTrLYuiw8y8jO6EF1DZadTeGLIoT0E2pJ+/vbySLk2czvWm8z1 7f9nfJXNovtUHckgcNfjGGgqmDvjiA+gIfSXGe8hVvyA89IlFFobMqPsU031d+yxIAEf 2aZQ== X-Received: by 10.68.243.33 with SMTP id wv1mr199631299pbc.143.1357694915560; Tue, 08 Jan 2013 17:28:35 -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.34 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 17:28:34 -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 5/8] mm: use vm_unmapped_area() in hugetlbfs on ia64 architecture Date: Tue, 8 Jan 2013 17:28:12 -0800 Message-Id: <1357694895-520-6-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: ALoCoQmegqwSxdaiXvc0mwUPzO/YOrvHXI3FO5DIZQmlZtwANj09ycoBzkgZKD1/xOj1OCjSl35EmKbBo0e2Bq+EXdrsHxLdtHB7PkQZrh3UJcKGnlGhREcxqbQgMrsm2f+gDUCtRzP8h4SdRnVgNVCy8KOe4W+H9IDSPSaZ6vRLR1CyNlhe+aIx4CFE0obnRB/leqkM2KTHZn9OWy1YorTAGzaFrNWTWw== Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org Update the ia64 hugetlb_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/mm/hugetlbpage.c | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c index 5ca674b74737..76069c18ee42 100644 --- a/arch/ia64/mm/hugetlbpage.c +++ b/arch/ia64/mm/hugetlbpage.c @@ -148,7 +148,7 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { - struct vm_area_struct *vmm; + struct vm_unmapped_area_info info; if (len > RGN_MAP_LIMIT) return -ENOMEM; @@ -165,16 +165,14 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, u /* This code assumes that RGN_HPAGE != 0. */ if ((REGION_NUMBER(addr) != RGN_HPAGE) || (addr & (HPAGE_SIZE - 1))) addr = HPAGE_REGION_BASE; - else - addr = ALIGN(addr, HPAGE_SIZE); - for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) { - /* At this point: (!vmm || addr < vmm->vm_end). */ - if (REGION_OFFSET(addr) + len > RGN_MAP_LIMIT) - return -ENOMEM; - if (!vmm || (addr + len) <= vmm->vm_start) - return addr; - addr = ALIGN(vmm->vm_end, HPAGE_SIZE); - } + + info.flags = 0; + info.length = len; + info.low_limit = addr; + info.high_limit = HPAGE_REGION_BASE + RGN_MAP_LIMIT; + info.align_mask = PAGE_MASK & (HPAGE_SIZE - 1); + info.align_offset = 0; + return vm_unmapped_area(&info); } static int __init hugetlb_setup_sz(char *str)