From patchwork Wed Jun 19 05:08:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11003367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 519CE186E for ; Wed, 19 Jun 2019 05:10:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4230328B4C for ; Wed, 19 Jun 2019 05:10:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 360F828B4F; Wed, 19 Jun 2019 05:10:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDBAA28B4D for ; Wed, 19 Jun 2019 05:10:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F250D6B0003; Wed, 19 Jun 2019 01:10:18 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id ED51C8E0002; Wed, 19 Jun 2019 01:10:18 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9FA28E0001; Wed, 19 Jun 2019 01:10:18 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 8E61E6B0003 for ; Wed, 19 Jun 2019 01:10:18 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id i44so24445722eda.3 for ; Tue, 18 Jun 2019 22:10:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=suPCocrA3QM64gsofO1CrTBeyBcHKAtqoGrxzUvLo4k=; b=YDtqX88FesVO+co+I7guJgHYPCt2IGk5xyXMQTOsqEUL88Z6sm/pv1Al5rbjQkhgkY T1Neu0wJKr7LqqIAS3N+f7AnNlWTiXSTb8nQTAmrVlBsk5iDTNodM5H1zaiVdGupjjsm QwuBMGfEj41dsdUZ2hktfYnUXWz2aYySgG4OvQy/JdDcqEnZOvbJyJBo7qPMERNpOCt3 hljHXkigVsGCWXm+i/6n5BrFbHgflS2OstZaMhsG74wFiyw24fJT8Ddvcp9Boi4SrHOg 6VA3u/0mglNBhBz+fEzKSzL6Szp5adzx1WgH5VSWY05CSXLjxEt9nwgnSYotNmxKeMM1 gMHQ== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.200 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: APjAAAU1BGpHgBhTNh1zIdu2ktIG024lqefVd6I39B2fFiG2YaMHJiZC rMhOsOB7zLkr1DxcKJXQx8puXgQrSJBodN+eCqjj9LdrIb7l2CWCkuWPPQlG2R51WCkeR93Aox5 HSBNcReb+NDMM1QSfYsLc4V4SW5kIfGAjFwpRD5Mz8SjLffkSAEHT/7r81FgW4F0= X-Received: by 2002:a17:906:1845:: with SMTP id w5mr44109095eje.0.1560921018097; Tue, 18 Jun 2019 22:10:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdJzhUFp8L1oJd5JOAl33GR9sFAGAjrHisw/PnLpruOEqrAeqvRtPWMK0aMETFAJ/0B57Q X-Received: by 2002:a17:906:1845:: with SMTP id w5mr44109040eje.0.1560921017058; Tue, 18 Jun 2019 22:10:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560921017; cv=none; d=google.com; s=arc-20160816; b=ZUGG62bu1MdrJLUdoeT+Yw0G5lnIN/TMhR5UMOK2eOExjA5K6MczG7NzZvPk+btdDK 0R7nH353P0eonQLUkUknFQihAVmqEl7mQYID6+Lf7Jg/ceJaYy+xw9YP4IUczaKUdyQl HWWA2gFpVHrUj8t6n6kpDDJRAPqFR3Z9eCICZ+TO6r1435iGu9GWoh+P2lTotIyChT5O H20V75luhbvsNVDkSfTkgvmLKsUUiRQqIluARVCdNTGp1nsXBzNhDzQ3xeJTHQG0O/zP UFcy0DZy+zOBNLPIkHFN/qHtccLVBawvvzf6RKR7PhrDGfX7rr72JB4PjPZbfRuyK1ad dkjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=suPCocrA3QM64gsofO1CrTBeyBcHKAtqoGrxzUvLo4k=; b=fDTPDoggLUVN70Q9ab+ghdQlG0J93LOj2LysuTLgDUjYmBDMmnqMEFe9Uf93YrRgh1 j3je3Wh4iBSWZeakUCuvlSbD/VLAwkSA59WtMNnZ5gc7CxDNT0RXOFQK7IKYKaiMPEfl VYaRcpmM7poSFygLFg42mEQZ3EL7IT6rdSI8mi0oCXryZ/CX2hc/4jLMbkyHnYdYjhcs wkxIF6Mif8aSTEuuNUkOQ1pB7KpDIpoPv3fx0cqt7kZGHsoYY17SYt+eTLztislbXUye mmZgmKtPGRQp4zkL2v8XNXVz7OpHkAHoxQ6bmdI3r+cAJjv8cB8Sm05A3NV7GwKRw2DQ ZhXA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.200 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net. [217.70.183.200]) by mx.google.com with ESMTPS id h40si13160243edh.219.2019.06.18.22.10.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jun 2019 22:10:17 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.200 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.200; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.200 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id C1E8920008; Wed, 19 Jun 2019 05:10:11 +0000 (UTC) From: Alexandre Ghiti To: Andrew Morton Cc: "James E . J . Bottomley" , Helge Deller , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Yoshinori Sato , Rich Felker , "David S . Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, Dave Hansen , Andy Lutomirski , Peter Zijlstra , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, Alexandre Ghiti Subject: [PATCH 1/8] s390: Start fallback of top-down mmap at mm->mmap_base Date: Wed, 19 Jun 2019 01:08:37 -0400 Message-Id: <20190619050844.5294-2-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190619050844.5294-1-alex@ghiti.fr> References: <20190619050844.5294-1-alex@ghiti.fr> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP In case of mmap failure in top-down mode, there is no need to go through the whole address space again for the bottom-up fallback: the goal of this fallback is to find, as a last resort, space between the top-down mmap base and the stack, which is the only place not covered by the top-down mmap. Signed-off-by: Alexandre Ghiti --- arch/s390/mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c index cbc718ba6d78..4a222969843b 100644 --- a/arch/s390/mm/mmap.c +++ b/arch/s390/mm/mmap.c @@ -166,7 +166,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, if (addr & ~PAGE_MASK) { VM_BUG_ON(addr != -ENOMEM); info.flags = 0; - info.low_limit = TASK_UNMAPPED_BASE; + info.low_limit = mm->mmap_base; info.high_limit = TASK_SIZE; addr = vm_unmapped_area(&info); if (addr & ~PAGE_MASK) From patchwork Wed Jun 19 05:08:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11003375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 22594112C for ; Wed, 19 Jun 2019 05:11:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1161028B4C for ; Wed, 19 Jun 2019 05:11:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04BF828B50; Wed, 19 Jun 2019 05:11:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9305628B4D for ; Wed, 19 Jun 2019 05:11:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CDA726B0003; Wed, 19 Jun 2019 01:11:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C8A848E0002; Wed, 19 Jun 2019 01:11:40 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B522D8E0001; Wed, 19 Jun 2019 01:11:40 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 6B5CB6B0003 for ; Wed, 19 Jun 2019 01:11:40 -0400 (EDT) Received: by mail-ed1-f71.google.com with SMTP id o13so24451699edt.4 for ; Tue, 18 Jun 2019 22:11:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=srNjincvqY5G24pyZeONdm1hP7PP/oYRsoEsOQD60iY=; b=Ql1euMJDp67c2PS1OiZsJzlduoCW0K7omssxOSc+k3mtZd5aJYdfxxknSRR17wlZbq azG8wYu7bzdU5VxsCalrn1OaB9x0E11hWpkjr3aANOmsxgYVSdU+vJbMyXKeUDoxHtY+ PeHrETfsYDposjNAnobEuArUkn/TiweCJqVnNbRL5eehyQHDgfYlowi+FnYS4PBop+lV EqE7tDcGGLJKodHq1qLyfqalcEjqMrCae/XB0o4jH+TZCxDbTA/jYTx+Wb6tcOhpmahY xN62sHps+5aldZyU3VR09WrGqjWZ9VXVd3yFyBhrjjjtb6jvr7XIszRrMbANEcCA6/Tp BvGQ== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: APjAAAWD/D1bxLpR6gTWYbuz2sNJ4qlhP9khNO2M4LaKBESaWliIUIyL sgM6fWfwXhxMKDTP11Ajh4dcZ63q1rsm+GukxExClEWLLnZY/qDr6CgCIFEzvKZ9AAp1MXnae68 0uN3/5wi4IWuu/M7Id+x5xKo8gtQyotdnLYQ5Pk7GqFm6Sq5n8j4nKRnZuhkZ6Kg= X-Received: by 2002:a17:906:774e:: with SMTP id o14mr7508004ejn.175.1560921099960; Tue, 18 Jun 2019 22:11:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDQjR1vfstl9qAMysWC8THO91Dj79C6PZUz/QR2BGZueQRNCo7ZGPiGzRlUEBG/SAHmbk8 X-Received: by 2002:a17:906:774e:: with SMTP id o14mr7507954ejn.175.1560921098903; Tue, 18 Jun 2019 22:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560921098; cv=none; d=google.com; s=arc-20160816; b=EdU7KM20Fo7LMODTLLgwsC/zx7XjfOQWFlOMSN9Ha81kxVkUV4/CD/708tte4z6WCn +/npX5e4DQ33sK5E6xHZpE2iPHpwjoJbi3Ovj86/L5LGKx1l1FGCtoSzCcg4m5tnPI7v M7UMzJnNwc4/8HAoM8zBNg5QiFivkYPnUaIFZHESn4WHnaqTyAFTzfJFPXCYWPgPCi3T eyfOJBzznQKI669J0IRDwQX52BzLMJXvAjYufJHxAdrOhsxvK9Q3gsjW2x0BIU1jV9CX vjyVC+KnCi8NY316DE8jVlEsmNOc/d1il3n/cSY0B0LNH5I6oNT4reIb+Z/gKM9sYJsR r02g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=srNjincvqY5G24pyZeONdm1hP7PP/oYRsoEsOQD60iY=; b=ExP1VT+mXSdi62xPEZpYLF2sLFEW6iadpBhQq6c3yV8+B0RlyYqLvfGbCNWIJIavQa GKbFUsRa8QWBzYbIhhH0uDRc3imWUAfHV0pqcRIMPCTy3bwgi7I2k0VtP4+RekCJ9MMz 05iggjzaW12QILeum3HNi5MjiXNMyvXUX2s/ZKJaEoPsu54J1OHZpiacRKz8/IVmuqOQ rz22xXzmTkPBkZOW9QZyMEancEeRdRu8N3JBv4qzmizWgHnAdXr4out44Jl5hgtEGRVs //Q94uyCI4i1inzm5LIKoHb/WDQTdjukjMERIUg51PG7ukYWXZKYjZrUwO96ZfYg08ep 8teg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net. [217.70.183.195]) by mx.google.com with ESMTPS id h44si12885044eda.49.2019.06.18.22.11.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jun 2019 22:11:38 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.195; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id DC9AB60010; Wed, 19 Jun 2019 05:11:16 +0000 (UTC) From: Alexandre Ghiti To: Andrew Morton Cc: "James E . J . Bottomley" , Helge Deller , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Yoshinori Sato , Rich Felker , "David S . Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, Dave Hansen , Andy Lutomirski , Peter Zijlstra , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, Alexandre Ghiti Subject: [PATCH 2/8] sh: Start fallback of top-down mmap at mm->mmap_base Date: Wed, 19 Jun 2019 01:08:38 -0400 Message-Id: <20190619050844.5294-3-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190619050844.5294-1-alex@ghiti.fr> References: <20190619050844.5294-1-alex@ghiti.fr> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP In case of mmap failure in top-down mode, there is no need to go through the whole address space again for the bottom-up fallback: the goal of this fallback is to find, as a last resort, space between the top-down mmap base and the stack, which is the only place not covered by the top-down mmap. Signed-off-by: Alexandre Ghiti --- arch/sh/mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c index 6a1a1297baae..4c7da92473dd 100644 --- a/arch/sh/mm/mmap.c +++ b/arch/sh/mm/mmap.c @@ -135,7 +135,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, if (addr & ~PAGE_MASK) { VM_BUG_ON(addr != -ENOMEM); info.flags = 0; - info.low_limit = TASK_UNMAPPED_BASE; + info.low_limit = mm->mmap_base; info.high_limit = TASK_SIZE; addr = vm_unmapped_area(&info); } From patchwork Wed Jun 19 05:08:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11003381 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7906114BB for ; Wed, 19 Jun 2019 05:12:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68EE828B4C for ; Wed, 19 Jun 2019 05:12:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CD2A28B4F; Wed, 19 Jun 2019 05:12:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E521228B4C for ; Wed, 19 Jun 2019 05:12:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 315296B0003; Wed, 19 Jun 2019 01:12:56 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 29ED58E0002; Wed, 19 Jun 2019 01:12:56 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 167248E0001; Wed, 19 Jun 2019 01:12:56 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id B8DFA6B0003 for ; Wed, 19 Jun 2019 01:12:55 -0400 (EDT) Received: by mail-ed1-f71.google.com with SMTP id r21so24420787edp.11 for ; Tue, 18 Jun 2019 22:12:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=5bGw2NpREzX2anVh0sOoL3eGIfQuEOpS1fnu2csVysc=; b=CJCpW7WJtqDIuxcFROmi5zhBr+0vPrQednBLftMEsap10X/sSP9dyeHtjKShgL40Kd vg/aGriJSK5bFrPo1B52emftv/ZfmLAy9zvfthWXh9c2QANR3qA8DvJlEOMDjWTZftcG Aoaj4eGZlUSlX+HYfli3d6wWNcFGEOEyobKi10gVX2U1R8qajPKchtptKJyeP+95QT8q +CtZg/V1TbdpVvKn0jHrvee2NoVqps05mIgyBMnHwSguXPQguWNYeTPEMlP3LwTOC6xB 5U/3jTG5B5RmjF53X2eiM5Dn7nEluDnSNdZp7B4ZmdCVvtDFBhqrUlxNn/lHttOjWYF0 XAgg== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: APjAAAW2aBr7B8GUV3u45incgiV/3XaO91IClKenKHvBp8KYN8eSwjG0 /V5ccE35pyEh9/X6zhUeyf/2R70v5W5YSK4qxqGoK5B6eljgodvSYsu49bb4D2StBy0UVhp5M60 v7P41QPqTmoGG6/WtmarEqHkSgNGGWajRbUZXezDuITccDFpdu8wz6mEA35leuAU= X-Received: by 2002:a17:906:474a:: with SMTP id j10mr83043887ejs.104.1560921175261; Tue, 18 Jun 2019 22:12:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQC8vKE6UpHs33s0ApWpo0TgysmSjAHhJSmaVKXUpb5AY/rqQemSfG1LictrpgFn3O43ie X-Received: by 2002:a17:906:474a:: with SMTP id j10mr83043833ejs.104.1560921174163; Tue, 18 Jun 2019 22:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560921174; cv=none; d=google.com; s=arc-20160816; b=rLbySKFkMnmhbAI/R6z4Z8cXS2r64M0dPeQj0A8p0eiksI5DIO+QuwIB9bTg+9lZ+n fs+FzZhYKVouOS+NWkbARQy/EQ60WyuAdwh3AFiQHigN8kY/N1sVhQrhTil9L1XQJMOc ChsOBqPITs94o6z5Jl2+/Iv5vk+t+2+JCyE55GOMnJ6PJC6qY+2H7p4eKr/E2faUaEbI QA70ih8cOfYgL78UwVykWhiwAN15cqZDEzdbMDzo8s1jRis/9uXLIAnv+YzawIOJWBfW QklFkCpYYfOO3VolOHwFaoPk04UYs9s19S8rk8BXxwoTBsW7kFH5eyBgNFmONbNIpJU9 dgYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=5bGw2NpREzX2anVh0sOoL3eGIfQuEOpS1fnu2csVysc=; b=GKkn4mG51NJFfw8tgKYXsr3VQY8YX0wUp2/uMtKZRg1Rh5J2Qh9HaPokZp4DK6iVN1 r5rWmgtyqCbblM09NZLAwRS8D0Sz67ImqDCW1J7pAqWsxDrrlQngqLwEHs77H3B12RS3 UdK5w5MOumOaojNxL8tu/e732P8YqBKc08veczMJj6vcigNy8KgsTPe1OYY2JA3aB0e2 51trOD3ClVbdR1OMp2OPw8MRMbPo3jZ+tAJgpFUfKBDFhXIBtsBf6alpII94GNLCN3VJ +BYBKiA7bJssCH6bdlEjaaVOvbnNAzVVU1iwIKyECtWvpcnK/25uWpgjlA6Tp9fLgsQO Jvdw== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net. [217.70.183.197]) by mx.google.com with ESMTPS id t24si10349759ejo.92.2019.06.18.22.12.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jun 2019 22:12:54 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.197; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 3A6441C0006; Wed, 19 Jun 2019 05:12:38 +0000 (UTC) From: Alexandre Ghiti To: Andrew Morton Cc: "James E . J . Bottomley" , Helge Deller , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Yoshinori Sato , Rich Felker , "David S . Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, Dave Hansen , Andy Lutomirski , Peter Zijlstra , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, Alexandre Ghiti Subject: [PATCH 3/8] sparc: Start fallback of top-down mmap at mm->mmap_base Date: Wed, 19 Jun 2019 01:08:39 -0400 Message-Id: <20190619050844.5294-4-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190619050844.5294-1-alex@ghiti.fr> References: <20190619050844.5294-1-alex@ghiti.fr> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP In case of mmap failure in top-down mode, there is no need to go through the whole address space again for the bottom-up fallback: the goal of this fallback is to find, as a last resort, space between the top-down mmap base and the stack, which is the only place not covered by the top-down mmap. Signed-off-by: Alexandre Ghiti --- arch/sparc/kernel/sys_sparc_64.c | 2 +- arch/sparc/mm/hugetlbpage.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c index ccc88926bc00..ea1de1e5fa8d 100644 --- a/arch/sparc/kernel/sys_sparc_64.c +++ b/arch/sparc/kernel/sys_sparc_64.c @@ -206,7 +206,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, if (addr & ~PAGE_MASK) { VM_BUG_ON(addr != -ENOMEM); info.flags = 0; - info.low_limit = TASK_UNMAPPED_BASE; + info.low_limit = mm->mmap_base; info.high_limit = STACK_TOP32; addr = vm_unmapped_area(&info); } diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c index f78793a06bbd..9c67f805abc8 100644 --- a/arch/sparc/mm/hugetlbpage.c +++ b/arch/sparc/mm/hugetlbpage.c @@ -86,7 +86,7 @@ hugetlb_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, if (addr & ~PAGE_MASK) { VM_BUG_ON(addr != -ENOMEM); info.flags = 0; - info.low_limit = TASK_UNMAPPED_BASE; + info.low_limit = mm->mmap_base; info.high_limit = STACK_TOP32; addr = vm_unmapped_area(&info); } From patchwork Wed Jun 19 05:08:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11003389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 19554112C for ; Wed, 19 Jun 2019 05:14:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 098B128B4C for ; Wed, 19 Jun 2019 05:14:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F107328B4F; Wed, 19 Jun 2019 05:14:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E04828B4D for ; Wed, 19 Jun 2019 05:14:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ADC8B6B0003; Wed, 19 Jun 2019 01:14:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A65AC8E0002; Wed, 19 Jun 2019 01:14:00 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 907368E0001; Wed, 19 Jun 2019 01:14:00 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 3E9C96B0003 for ; Wed, 19 Jun 2019 01:14:00 -0400 (EDT) Received: by mail-ed1-f70.google.com with SMTP id d13so24456437edo.5 for ; Tue, 18 Jun 2019 22:14:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=SHkC1mZg2rp08rzAypemwkUbAlcN9ysauQkDyXk9YVg=; b=DdSJzvXzun4oadw/n3dE3Z5WHQUZWQ58B06SDcJ8DXWVUmts+lIPSrk6bCinqxx5s7 zgWy2Gxsz14tgioQgNI9YAcm9t/w722LqVY6dJ95bDoS50Ey+TVBPO9zLW0Ujdmu1Dcx Ej3VOdJL3kFO1uplbNZU7Ba0gQRGwKgqeT/WpeesbAsKZbBVdnCjsy9ODqg7AnS5N8PX tAyN0434Bwo4gUm/F6AQitEeDN1gjjocY1j2CcAXYTgSq1+5D7QEdtYFz8zYpF9yyhix p2bbOcpwo9JjSRDO2AUqvHUhkyQK2McWTqL9F9P9KxnCb5A9B35x5dg0MvSqvpBSD6ek 8jog== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: APjAAAWzKXz8ByvYn7n19JuJKelvzH9QfDE+rlC2LJi7s5V9yldWJwuL 1aOyPCy41e4MKexMbn2KE3eHVkd5tIXVeIDTmDOJApJziKccdy07lC2T637V66HOlmAEXaKwtYb h78qRK5L9qpQ4MQ6HvQbrT6rXRnghY1mi8YwbS7cfC7O1p9xowyHi9xQEiED0MsQ= X-Received: by 2002:a50:8ba6:: with SMTP id m35mr71178341edm.199.1560921239781; Tue, 18 Jun 2019 22:13:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzaEa91jAhPYehtN0x6YiBn9tMK2qorIhKfkuGLC4qJi/zTpFdjqk1cDX+Arf9kW8Q77KGL X-Received: by 2002:a50:8ba6:: with SMTP id m35mr71178269edm.199.1560921238752; Tue, 18 Jun 2019 22:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560921238; cv=none; d=google.com; s=arc-20160816; b=CnNVSx3h0RCJloZDcCAM5DNyoc2fYhYHhwcKFm3DHbEYEkKcjvSdAu9wvZs+DciCh0 9GWXES+haT7LkVTBsYNCNh7TlWg+/xxwuFCr2JHPYgknnJax9RZ5GdOQSJtge9SmlfZU Y8Zd0KYJ4Q95/Fx532uAAhAOAGsT/Vr4z7sm/xW9m8btK1KbWElWhR5/JXHrF+bsYY3h 9tbVKJd4ZVlWC6vlZZrXojozpXWdXsifzQY+UOghEu8Db5Ew+6nC1lY6febqXf1ZRF5y g9Vd6/hVyS5ODXZm/vGVt5wHbte7ffWnMvW32r0j4/FO3Ls96LTOUChysRaGvjrUO3V6 9NpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=SHkC1mZg2rp08rzAypemwkUbAlcN9ysauQkDyXk9YVg=; b=eqgC5thJf+gxu9GBI7/2XSXSdMu9ezvhJx8r7HNN/awLVjS+KybcnxHGyzpaINlFCX 7eeivMYSNz93CIi02FChmi7Up9ueP+YkGgoOyZqIP2iKSD0gXJBxNXsraU4/xlOqpdfm OIDSSRWJzFWO3SrADAjNg1C/YEYmDtswCEy7uG44P/ZpaML3XCeEcR83jwXNyGkyWp/j 6Uciay6BNMfT/KcE9EjMslTGOZjUb73bc/ZnljSZpiC6wzENBnRDmL1K/zTBnR2oFxKO chb1Oo9KK+58DJhg2Bl6u4Dw/3+meUouJObrGR5yJOipqDVvYLmKjkedvk7VV3HrVAVY bGEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net. [217.70.183.195]) by mx.google.com with ESMTPS id f58si12948135edf.135.2019.06.18.22.13.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jun 2019 22:13:58 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.195; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 46F1560005; Wed, 19 Jun 2019 05:13:54 +0000 (UTC) From: Alexandre Ghiti To: Andrew Morton Cc: "James E . J . Bottomley" , Helge Deller , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Yoshinori Sato , Rich Felker , "David S . Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, Dave Hansen , Andy Lutomirski , Peter Zijlstra , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, Alexandre Ghiti Subject: [PATCH 4/8] x86, hugetlbpage: Start fallback of top-down mmap at mm->mmap_base Date: Wed, 19 Jun 2019 01:08:40 -0400 Message-Id: <20190619050844.5294-5-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190619050844.5294-1-alex@ghiti.fr> References: <20190619050844.5294-1-alex@ghiti.fr> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP In case of mmap failure in top-down mode, there is no need to go through the whole address space again for the bottom-up fallback: the goal of this fallback is to find, as a last resort, space between the top-down mmap base and the stack, which is the only place not covered by the top-down mmap. Signed-off-by: Alexandre Ghiti --- arch/x86/mm/hugetlbpage.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c index fab095362c50..4b90339aef50 100644 --- a/arch/x86/mm/hugetlbpage.c +++ b/arch/x86/mm/hugetlbpage.c @@ -106,11 +106,12 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file, { struct hstate *h = hstate_file(file); struct vm_unmapped_area_info info; + unsigned long mmap_base = get_mmap_base(0); info.flags = VM_UNMAPPED_AREA_TOPDOWN; info.length = len; info.low_limit = PAGE_SIZE; - info.high_limit = get_mmap_base(0); + info.high_limit = mmap_base; /* * If hint address is above DEFAULT_MAP_WINDOW, look for unmapped area @@ -132,7 +133,7 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file, if (addr & ~PAGE_MASK) { VM_BUG_ON(addr != -ENOMEM); info.flags = 0; - info.low_limit = TASK_UNMAPPED_BASE; + info.low_limit = mmap_base; info.high_limit = TASK_SIZE_LOW; addr = vm_unmapped_area(&info); } From patchwork Wed Jun 19 05:08:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11003397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5982513AF for ; Wed, 19 Jun 2019 05:15:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A3C728B4C for ; Wed, 19 Jun 2019 05:15:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AD9E28B4D; Wed, 19 Jun 2019 05:15:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D829028B52 for ; Wed, 19 Jun 2019 05:15:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1DC156B0003; Wed, 19 Jun 2019 01:15:05 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 18B1B8E0002; Wed, 19 Jun 2019 01:15:05 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 053968E0001; Wed, 19 Jun 2019 01:15:04 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id ABF996B0003 for ; Wed, 19 Jun 2019 01:15:04 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id m23so6839094edr.7 for ; Tue, 18 Jun 2019 22:15:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=UWpdnrbGefkQI6ssngVxJNkCRhvWsEseMpLH8MS8OO4=; b=rGNAX5Db5Qz3N0SV4KZhJkMUTVQ2Cy0QvAgndiqNr/KQwHaCzhliisDpFBj6eUecTA u6kKHDxq/MYdSj0PBN1L2rlEhPi99uKOjkIbp3N/IuiLEtNk79pmuXPPjr6jP+W4DN6A DTOHVDiGx871EiPklsaNcE0TV04mNcdPYFm6HDcoanvMut5E0bEmKNeGVPlUOMmMd8zg D836lVrVG4nhk2ECY0yD3g1d4kad6waQSh8B2M4ZcxMLUnzllnzsFju8fiucFKTnsb0A wyL1TopP8lx/XCmfqRQ5ZanjF87ZerOwONUd2HQ1RvvnRNrVlC0lYuBrOF+ek03gF7g0 ISpQ== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: APjAAAVqM7tvbSqSmIXqNkGy49DtkijPHUugYdedJ31KPlSvFbEu4K2d C2eutAeKbrPmaRWfP00FR6Nusjge4t7529pPTTREsUBUJFiv1ESqqbRlFGHGuhQRveye+9o0xgi pMlPFGsJ+jvGKFkBaVvVUGswDPXf5ymGZCIi7PlQTSfpTMJEEGC1l9USWU9PcR0Q= X-Received: by 2002:a17:906:1804:: with SMTP id v4mr2336494eje.188.1560921304196; Tue, 18 Jun 2019 22:15:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxziE3jD9L9/Yq2WtLjuH0JWTEOny/7v/SkFO3LFu6w9EAFoK6w6oVCsJ0S2b8GUizC68x1 X-Received: by 2002:a17:906:1804:: with SMTP id v4mr2336434eje.188.1560921303159; Tue, 18 Jun 2019 22:15:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560921303; cv=none; d=google.com; s=arc-20160816; b=SRzjLO5q9UAU0jw31cJaEYeFyLnakqF6DKcRFy1Uxe7VILSCW4a7T6tjUUklR4ubUm 15jjmRZdEAMYO7IdE2Uvp/6NnjmdnBHm4Et6m9GgCmxmvlI4TCk33nqd3TLxEd0dmQKz vkETeVVi4oZ50MqbUpiEFESLU/yv1T0PVVVsWSuWXGEUVpO52NMODQuQQfe0UYX0Tu2r vJS6dos0hzFXQ3eO88bE5nFvRsdhiYVAhVYsf0leIxOVR9+xbn8KpdoZdU3qlXjzph/F DquMcfKW6JdbSMMBO0tMxuqFOirs9NR459UPtgUtbKJuGQQrtC/ax+SgKIao01Si37Jm UCvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=UWpdnrbGefkQI6ssngVxJNkCRhvWsEseMpLH8MS8OO4=; b=qDPDb7qtqbdTpFAvVwuB4gBRsV42k5lCZNBOa2qMIg7xjDpidpXsd9I0Tk07PWXX/q wxx8nFDZxJ4tigELULq0D/kqH0Ofa2HEGhC/udD3rVEqI+lg5NxpTvaxXM2PCHT2gRHZ 5Zg4jZ4doitqOIP8OuyZ9e0S33U4FYJGCUMAE3ed50oSSpT8W2cRLUgKLO11WaQ2+Jb/ YDpmQuTzr/Jqn/AcYafWm4LFdYRkqQsgnpT7gJ4JkE5HLImYjjRb7CkM5G5Ifl+v2aOy ovmG3egorPIMm6VfekGo613NV2xBMgHu3UBUe0t1h3xBFFl27gWP9LqkHu5mrrr9eb8U B2oQ== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net. [217.70.183.195]) by mx.google.com with ESMTPS id q55si13532093eda.257.2019.06.18.22.15.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jun 2019 22:15:03 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.195; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id E2FD860012; Wed, 19 Jun 2019 05:14:58 +0000 (UTC) From: Alexandre Ghiti To: Andrew Morton Cc: "James E . J . Bottomley" , Helge Deller , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Yoshinori Sato , Rich Felker , "David S . Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, Dave Hansen , Andy Lutomirski , Peter Zijlstra , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, Alexandre Ghiti Subject: [PATCH 5/8] mm: Start fallback top-down mmap at mm->mmap_base Date: Wed, 19 Jun 2019 01:08:41 -0400 Message-Id: <20190619050844.5294-6-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190619050844.5294-1-alex@ghiti.fr> References: <20190619050844.5294-1-alex@ghiti.fr> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP In case of mmap failure in top-down mode, there is no need to go through the whole address space again for the bottom-up fallback: the goal of this fallback is to find, as a last resort, space between the top-down mmap base and the stack, which is the only place not covered by the top-down mmap. Signed-off-by: Alexandre Ghiti --- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mmap.c b/mm/mmap.c index dedae10cb6e2..e563145c1ff4 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2185,7 +2185,7 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, if (offset_in_page(addr)) { VM_BUG_ON(addr != -ENOMEM); info.flags = 0; - info.low_limit = TASK_UNMAPPED_BASE; + info.low_limit = arch_get_mmap_base(addr, mm->mmap_base); info.high_limit = mmap_end; addr = vm_unmapped_area(&info); }