From patchwork Thu Jan 24 01:29:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 2027541 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 63B78E00CF for ; Thu, 24 Jan 2013 01:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753047Ab3AXBbd (ORCPT ); Wed, 23 Jan 2013 20:31:33 -0500 Received: from mail-pb0-f43.google.com ([209.85.160.43]:53453 "EHLO mail-pb0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753220Ab3AXBaG (ORCPT ); Wed, 23 Jan 2013 20:30:06 -0500 Received: by mail-pb0-f43.google.com with SMTP id jt11so3700858pbb.16 for ; Wed, 23 Jan 2013 17:30:06 -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=mV+euVge+YB1j7tjHbw6tjUIz/7HkR3ee09V7QzW9Uc=; b=AEailyxWAzT/rUXrtJVoZrzTzNe1c19i6BXYtxWa/ZAqFfyWkAQyu61koKkwfA/IXg 9fBLVhcoUAOBLYfccSvC0+ZXtkd9vQMwZaLEkhKoSokS24iIrD3VsJP2DqwZKv9BoYJX vezXkHtglRfSQbLf8NzAx/0OB8Bm2XpmNKaKcBb+PCzlJ2d9AuZiynXbWY83rvggEjCb QPD/C7QNE6HP5MblSzvQatbDhkU1MWcy7oi/O2pt24tME9CeJnrRVuQ0He/mtn6P+CLX yOzd97oW4W4eaRFVBtMSHVuAfJ0dk733WB0ieOndxs4I0W6+zzpLDraHQPSlUuuqQk2h TvWw== 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=mV+euVge+YB1j7tjHbw6tjUIz/7HkR3ee09V7QzW9Uc=; b=UJfhvLyk4VPcRQQjXzVUsnFNvwJtERRZPBr8+cz8rHZpOxU9/39TBVtSGRyIyDo4zn gwBLkuUfd3bmrSPGfbwm6xyA2ozqJ468wwi9b934B7DeEWU2DbJQGvXfG6XPs+JNVbtF XFnvq8Ml+BC1J5mDfPBcQu/HlPQjsyVVgMTUUbLys8QnUigDJeKawsbW//VdHsDcLPF+ kD1qAWb8kOABf5gZ17ov4OEckew6wh7rzgtTHY2QRO9dq5kCVFYcsaoUmi2SmwLiy4xh Lh7fzRBKM4g5rzA046e0ihw77EYd+berxmLjfYCtbz4BtXoOCigyAHXqjBVL+JKo7Nj4 GK3w== X-Received: by 10.68.234.36 with SMTP id ub4mr555069pbc.68.1358991006209; Wed, 23 Jan 2013 17:30:06 -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.04 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Jan 2013 17:30:05 -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 5/8] mm: use vm_unmapped_area() in hugetlbfs on ia64 architecture Date: Wed, 23 Jan 2013 17:29:48 -0800 Message-Id: <1358990991-21316-6-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: ALoCoQm/cBfngLMQ16LZx+Q+8qbl+HDY9Iaxsog8r02HMV3xRLRUKzWAIY0vk8qydhhx8pBAcA9gvvDdNzYD4Ymbgr4t79KzHsaQ/r1ceycq9lq0Jiw8W8bO+0S2ypSl/ilVDtcDRqSoogzbVxIaEh9IDsbwxlNRnJKUkGZI4wH0Oszms0MHv8Na8ZxDlqxyfiuiAyEyyPVEs6lQH7THT5apYG/inraqiw== 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)