From patchwork Mon Nov 5 22:47:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 1700981 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id F00773FCA5 for ; Mon, 5 Nov 2012 22:57:24 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TVVXV-0003XK-4o; Mon, 05 Nov 2012 22:53:08 +0000 Received: from mail-da0-f49.google.com ([209.85.210.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TVVSY-0000Iv-74 for linux-arm-kernel@lists.infradead.org; Mon, 05 Nov 2012 22:47:59 +0000 Received: by mail-da0-f49.google.com with SMTP id q27so2653732daj.36 for ; Mon, 05 Nov 2012 14:47:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=1bdZJOJFyYYe3TNi395CJvw+NxzxEeeJWLV7JAFL6Og=; b=AIjPq8XYet9dz58VUHqEj8ODrvi2kBJdwDm82I+kl5Op6Z5XoxIHFhhjVjERTM/fmZ NHemXX1nz7aDbEmv8TpswcOVQ9FvnlTn32JxPDBG23A2ArdZwJiQdhUKuM6riTse8vq1 LJUPU7mfigQbkCjzPnEZf4EADOo2OGXJ4dnRbQLH3t+A8nHBbtCOr4YZ/eBgfuEeAAFc DevtFLiCw+KlzGbTZ7IQnwO+gwGX1J0+n75aQw/B7MX337dy8TLBw03RhFezM8PurhcY sspM+kO0FddD0VZxIwh/wS3A9nKyjcGt1FAfLWQ64b5B9Sx0sgmeeth/li/oG3HX3jaW HpzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=1bdZJOJFyYYe3TNi395CJvw+NxzxEeeJWLV7JAFL6Og=; b=Jw35fLuPZOmtjBlUnm7l6rq/Y8cCnmHXrwhkiCM1Hy5O5Zwphqs8hMYQXAyLRcCP/U 8xyfQbCFp1j0fnV9Wy1Wb0KtzYaFsUfwocG7igNoSINxw3RNAthNUG5lVzw4EZNUHfky zvO+YpN2CZ13IG6ckFzGY2GTz4NJn9uNUbA5K3+9xpPv8ZFSagjntSQ+VkdVyd+pDVyi rSF7HiRb8evPEZXXjbxIAP0wxWC/9Q6SjOnezfFWgvSDYIV7FRJI+tmnwoo0JGPjdqOb fLh7wqd5QIrvPpdsyPZ7ImxM5TyY23aqYfbT3C58T0y7Vef6+cASXG2SkYn3ZWp5D/kh fcbg== Received: by 10.68.195.165 with SMTP id if5mr2589992pbc.131.1352155677624; Mon, 05 Nov 2012 14:47:57 -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 jx4sm11201653pbc.27.2012.11.05.14.47.55 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 05 Nov 2012 14:47:56 -0800 (PST) From: Michel Lespinasse To: Andrew Morton , Rik van Riel , Hugh Dickins , linux-kernel@vger.kernel.org, Russell King , Ralf Baechle , Paul Mundt , "David S. Miller" , Chris Metcalf , x86@kernel.org, William Irwin Subject: [PATCH 15/16] mm: use vm_unmapped_area() on sparc32 architecture Date: Mon, 5 Nov 2012 14:47:12 -0800 Message-Id: <1352155633-8648-16-git-send-email-walken@google.com> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1352155633-8648-1-git-send-email-walken@google.com> References: <1352155633-8648-1-git-send-email-walken@google.com> X-Gm-Message-State: ALoCoQl9TAgF/U6KqreNy1qdB32+13di8PyKblRb48ije5svqnZdHkkop7hAUTDussDNbjw3tpQbd8VoJ83Pw196aVi/DsbLjQPH51bJlQtFULC4qyt8zpO/P/tohJM+wXGMEt1gLE7KqhlYkFsRbl5/4u6Ji7zqawAv1zooPWW03SMpPQrUKAzeIDVSZFKAx0ftYsfy9yks+SV5l/AqWoN97jtd3cUNxg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121105_174758_638150_343C8984 X-CRM114-Status: GOOD ( 13.02 ) X-Spam-Score: -0.4 (/) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-0.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.210.49 listed in list.dnswl.org] 3.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: sparclinux@vger.kernel.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Update the sparc32 arch_get_unmapped_area function to make use of vm_unmapped_area() instead of implementing a brute force search. Signed-off-by: Michel Lespinasse Reviewed-by: Rik van Riel Acked-by: David S. Miller --- arch/sparc/kernel/sys_sparc_32.c | 24 +++++++++--------------- 1 files changed, 9 insertions(+), 15 deletions(-) diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c index 0c9b31b22e07..653899849b27 100644 --- a/arch/sparc/kernel/sys_sparc_32.c +++ b/arch/sparc/kernel/sys_sparc_32.c @@ -39,6 +39,7 @@ asmlinkage unsigned long sys_getpagesize(void) unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { struct vm_area_struct * vmm; + struct vm_unmapped_area_info info; if (flags & MAP_FIXED) { /* We do not accept a shared mapping if it would violate @@ -56,21 +57,14 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi if (!addr) addr = TASK_UNMAPPED_BASE; - if (flags & MAP_SHARED) - addr = COLOUR_ALIGN(addr); - else - addr = PAGE_ALIGN(addr); - - for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) { - /* At this point: (!vmm || addr < vmm->vm_end). */ - if (TASK_SIZE - PAGE_SIZE - len < addr) - return -ENOMEM; - if (!vmm || addr + len <= vmm->vm_start) - return addr; - addr = vmm->vm_end; - if (flags & MAP_SHARED) - addr = COLOUR_ALIGN(addr); - } + info.flags = 0; + info.length = len; + info.low_limit = addr; + info.high_limit = TASK_SIZE; + info.align_mask = (flags & MAP_SHARED) ? + (PAGE_MASK & (SHMLBA - 1)) : 0; + info.align_offset = pgoff << PAGE_SHIFT; + return vm_unmapped_area(&info); } /*