From patchwork Thu Jun 20 05:03:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11005829 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 418DE112C for ; Thu, 20 Jun 2019 05:05:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 311EF28478 for ; Thu, 20 Jun 2019 05:05:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 208602847B; Thu, 20 Jun 2019 05:05:10 +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 E9EC828478 for ; Thu, 20 Jun 2019 05:05:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17C856B0003; Thu, 20 Jun 2019 01:05:08 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 106B18E0002; Thu, 20 Jun 2019 01:05:08 -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 EEA688E0001; Thu, 20 Jun 2019 01:05:07 -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 A04626B0003 for ; Thu, 20 Jun 2019 01:05:07 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id k15so2580112eda.6 for ; Wed, 19 Jun 2019 22:05:07 -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=B86Y7wX24/hzbysfMlj61Ty3jVAZiYhFpPNBD3EVTQbFdnFY0Ez+GPnFJrDrM7QpBH nX4BAuURDhlg8GTWMAC+1I5pwTQE1MOp39Nb7QdhSn7cQOhI2bYXdMukaY9SSJjrInz2 UET5mNJpOZt1nlA75uLLL+PJDM/gzGO1+5h4c1Yh2DQRqsQZZVsduZ/jhQ64nNJs0WeC LXqwz3jFz0j7kOVyod/OS0MpgCh5CtkdW5onCXbqAWp3zNaDKMfRonXtmD+8z/r4xiMI /whVNEreHrAe2Jz76ReNwTBHG+tFPGACuroSuaMNK+cmOJyCiw/EwNhE1KkVE7kgJ1vH YBvA== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.199 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: APjAAAXOLBLeOPQJ/hU6YmAb54qYFK/lvJ6gBmZksNjEzg5sMsbcs+4n vM6539BpJdwfcGW25ibaAImToOp0frQGmO3lcLCbfMHiohwdNjiin3T7f+qEday3+DyuwA3Nk+Z oHNpa0+14QBbwwNAL4n3TR5XjcAxI8vzaXIgjtM/PtDlwxuyPREQG1/9bctibEhU= X-Received: by 2002:a50:c8c3:: with SMTP id k3mr63726375edh.189.1561007107122; Wed, 19 Jun 2019 22:05:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJx4KDEDLLP1NDsP996iowDXDHF1+w+XKSjB92VmG4eY85uJjtH8xl+x/sbeguhUoVoEBp X-Received: by 2002:a50:c8c3:: with SMTP id k3mr63726299edh.189.1561007106208; Wed, 19 Jun 2019 22:05:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561007106; cv=none; d=google.com; s=arc-20160816; b=Xnzcb+7JsZwqvgVi2IY0k5XoUzqoQIX4C+LnZb1Tg3dZwBCvqhyuF4el1yBGPwabXr ihsU6b3cKpA6DPCHGeX0FW6ClrTBvTDlq7DrjoppOUR4hDmocRnF0TrK8y1aiV+3S9nI FprWTmJMwjtJU60bpFMCkRGCyVya2ClVZ0Xv7Z/x9LSm7Ccry+ihCcgxxjBtdm8mgQF/ q3w2sffB8/dH05luBplP91gFvXPrwfrcTposn1dEHj3A3eHER+ET6Ko6N77102p0keCr i1Sspbgq6ovti1dL0yUYOEIYNDTircFnDsLsL62dRJGeYeRq2/a6l01mV4sGMrpFLcXa 1/+w== 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=hzB9DynzHh4wx01jEp+rUGihAjDBYr8ZA30BreE7YXlpKYVBA76kjRn8hBA3+bF23I tePmQLnn1/QbEFQ9KCM8QYzmLL/IKJQpQO6I2pmp6X8064pe2s9cNZdfccCMhxMfAQrs WEU30d8wSylXTsUua1Acc5TF3PGF5IlewZvLt5YRmb2rnPktZW0Zst0fHLrjy13HvryF sebBEJgzUEjxWNii6zQZpqTXKVxxvrhxvw44eqgTpRQBjPIATaTg5Dp0iAyf/6tI5ekr Jyxn4x2tRW8mgWw1w2N0hfH4Kb7LE51sMHCnJOffgiAppgGMFRZI3zXOIyI2KzbAtvkb I3Bg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.199 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net. [217.70.183.199]) by mx.google.com with ESMTPS id g23si16093237eda.289.2019.06.19.22.05.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jun 2019 22:05:06 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.199 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.199; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.199 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 relay9-d.mail.gandi.net (Postfix) with ESMTPSA id DA6C6FF804; Thu, 20 Jun 2019 05:04:55 +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 RESEND 1/8] s390: Start fallback of top-down mmap at mm->mmap_base Date: Thu, 20 Jun 2019 01:03:21 -0400 Message-Id: <20190620050328.8942-2-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190620050328.8942-1-alex@ghiti.fr> References: <20190620050328.8942-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 Thu Jun 20 05:03:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11005837 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 9E4CB112C for ; Thu, 20 Jun 2019 05:06:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BF4D2847A for ; Thu, 20 Jun 2019 05:06:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B2FA28488; Thu, 20 Jun 2019 05:06:23 +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 5A56B2847A for ; Thu, 20 Jun 2019 05:06:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 76EA66B0005; Thu, 20 Jun 2019 01:06:21 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 71FB78E0002; Thu, 20 Jun 2019 01:06:21 -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 60E638E0001; Thu, 20 Jun 2019 01:06:21 -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 133D56B0005 for ; Thu, 20 Jun 2019 01:06:21 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id c27so2579093edn.8 for ; Wed, 19 Jun 2019 22:06:21 -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=p7rtKItg4HeiBJjaJRNRRWS8UZP8067XRN6QDdISEd9c4iosDTAI93lLRESnY23hWe Kkqv8FLUQ982IZgNKVrxD5SLloA2nSXRc7dDMysavY9/UCthY8KdGjzfLgqd3u+NQ4Wd VZ5//zMKb/dGpsuc5vaIcTYg5YQIEkDdjGSqAjS0s5NrgHSIXdSSwsWf6v9yobREc/OQ hkmMki+4OIjoyVDlx/fLI5hlVaf1IPoKGLenSnXGrYEP6W4D6INWCCJVzJeXP4ISBG3y BQbmvdAdjEwqB19rOiUqyKvqI8Pyf/tS5GvSsYiI1qTztbgLQaGI8ZMtIrjuLvfXvhYT 6UhQ== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: APjAAAWnpSQcBaQhoQpXu/s8Dqm30IWQ6lIv4hLWSQb92Ip3OBK9B9gG EgJ3URD7oXsq7/x3qmgYv6T+1O724JNkZV9rwmQjDHgIo0shKZdbRtoWOnZLosdPOhv1iark594 F2/so1AIgprhNq9dIo6dTEGvn8xWcAFfqz/p7UQ10faZJ2xowQNrbRCjIizjvo+8= X-Received: by 2002:a50:e619:: with SMTP id y25mr53881250edm.247.1561007180614; Wed, 19 Jun 2019 22:06:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqybAq9ISKHAjgkcAt+Sz7t7HRs6w3mrcoIIIzK9+etuCAOxhvJxoyT5GlEiQnuZJVTh+S3x X-Received: by 2002:a50:e619:: with SMTP id y25mr53881195edm.247.1561007179644; Wed, 19 Jun 2019 22:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561007179; cv=none; d=google.com; s=arc-20160816; b=bEaDZ5rM1AS849/QdHiEtXZIHPEGQgDegRupItCM7SwgOZhtSKxgMzIouRRnXS6ezk S1yeCva6zRPRDD5j3BAAgcMU7kdNTMVm1oi57vPjtKbkzYdOaqH5kewrS04BclZgLgKW oxVG5agJkFDlIPNHnuyumil5xW0ZofyKYMevHfD+Vcc3ROiRaNJedc24uQglCcm3sQsb hZiolPxcLYLqLnl/EZHQr+Vkm2I6Al/HscB833VUvES1Szis28jlr1q+7lgpDHYNvjdA ohdoWyyMfM1ICu6Y7cel2rgSRndGaFWj//NPDhvy5HReDdFrCrXDsHE/c7Jj/wbCryo9 tCYQ== 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=spwhDVj2tfjy4LqugDmDY4V6YJhmbbAW3qB6q5ylCy+Ceh59sqqjeWnVWqUhFePZJo aYOkgW7OdBKUH6zXHmAOnoNaj8lAovCsc5ukQA/GtnpV67Zuwp47MVdaVHYxO+BbBTrL knUgROUayizrVplFVvEaDpzV0hjrc8v+h5sSQF6IToFirz6ABp2vHHYGxiGSLX1giq8Y jP8N5dDza5QTEC4wth6b7+Nwz3lVLe0D0QikkR+006/YOlV80xuJ/B2Kg2O4HVZoV3KF 4M1OLKa1fVdX3OYjiYc6L7CzIsKWGPmpBww2rObtXp0F5x9nEK4DF8IA2i1y9UwsJz8G nV0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net. [217.70.183.198]) by mx.google.com with ESMTPS id v4si10967063ejh.371.2019.06.19.22.06.19 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jun 2019 22:06:19 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.198; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.198 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 relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 476DCC000A; Thu, 20 Jun 2019 05:06:06 +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 RESEND 2/8] sh: Start fallback of top-down mmap at mm->mmap_base Date: Thu, 20 Jun 2019 01:03:22 -0400 Message-Id: <20190620050328.8942-3-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190620050328.8942-1-alex@ghiti.fr> References: <20190620050328.8942-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 Thu Jun 20 05:03:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11005843 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 39D49112C for ; Thu, 20 Jun 2019 05:07:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28D332847A for ; Thu, 20 Jun 2019 05:07:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B6D028488; Thu, 20 Jun 2019 05:07:37 +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 AB43E2847A for ; Thu, 20 Jun 2019 05:07:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BBB56B0005; Thu, 20 Jun 2019 01:07:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 76BD58E0002; Thu, 20 Jun 2019 01:07:35 -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 682BD8E0001; Thu, 20 Jun 2019 01:07:35 -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 1BED26B0005 for ; Thu, 20 Jun 2019 01:07:35 -0400 (EDT) Received: by mail-ed1-f71.google.com with SMTP id i9so2561209edr.13 for ; Wed, 19 Jun 2019 22:07:35 -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=U66Wti4UBeokh+VggQOqXVCvonXNkk6nBaCAQQsmVVShu2ypDIW8YAz1pilFS92uaZ /fsXuAuX3yYjMDPAzyHHDiuVudvV4PTpL9MgRsRnDOIHpSktznkDIDDAarRAYh1whsK2 zxXuhGKFKQqkPpUla1eRF5DCZspDlm6tMHl/7LEfQovE/1D2wu7rCdfR5mfzwYlFNP3a XV52c0Z0LSeTufQdaZU/VgnJouFs/rDCzsRmXrulH/vIi/R1OiqTXlGWu6vwMPronMAY EMjLgNEdDR2LMY1GCwvK30Vq/7a2dljBJlLpdj+zrRbLTICiLGiXTP695q+vYRCudOR5 C9og== 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: APjAAAWkzmUD9K9Yew1H2I7eVM7+SCSHUprWHuoYA/kV6GjaKMrYf+2F Rqn2DY7hBWC5gU8anSNi7r0USW4BrGSfKHJ5rg4bkV37BLC1u/fVahRwVCfHu35ZIqMbrJB36Wv 8/MZKkBqHJb1N1N2B09TBwwxepg2kvhmi1UBXkdT6n3YzeYzZOHIG3aUf2GY20+Y= X-Received: by 2002:a17:906:41c5:: with SMTP id g5mr6902979ejl.114.1561007254617; Wed, 19 Jun 2019 22:07:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqwpf8ZDCSvGiPrJRxsllkFC3f1TNZosevmPkvb5o878dYmb6K1gycdbOVwrRvtZo0LF0K X-Received: by 2002:a17:906:41c5:: with SMTP id g5mr6902926ejl.114.1561007253838; Wed, 19 Jun 2019 22:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561007253; cv=none; d=google.com; s=arc-20160816; b=oQJ5WNTwBJm3e5SmBhrzyxrPxfU/845V8qqENl3cpXd5La3fdWLr8FNG3RUTMlML+t PnoDRv52MDspNJMCBd3k2SLK5OsPUPKJcLlYjMObv1mJdEzN/mXKtS6Si31kBeAMJzQP zSHME7W3CeD0o5ACAjiEKs5KIbq/GIJmU5Yv3zRruZEKuUSLDaQaEsX0FsVPqay0Cz07 PViJo+k6fsifetq6CA5LVItjTUzQMGLtMC6Z35TM8iR4quRJVwWJDjF4DC1LH8uouCjp TvvX9Yb5qAVwY2MQVOBMOi0LV0aCw+23D4ifUO04Bj8ixpXE7J+ahUZaY6cVwjieuCmx 1z4w== 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=UFUIqnd9BWq5kmgrfVOT4KpRJECSH1Q58xM+FHrUElxC9sZmi7CDRfssVkSHj9j3oE PStApaanjGih7FIzLY3TV9wBZXl2QU4rQxBcpKlW+x3zto4/kr8Z3mjLcGK6Yv/+//0q PnbLkAbKZsOKgbRZOC2dHvziWKLd2id5qjeNL39n4kV6yxCiVc8eWAq+KcNeKP8nBKOU lBESdgvpREG2v8wIR7Axh3Kl063T9Ki18jAxZ6wzM9nbbwf+Ujh6iGiMht3L0FXXHzwA UcFy8SC7QjuQHUL89PxTpyvcBM9YCsUhKMLW0vd4TvACZzHnf1P6TNBC/dUaN2MXPlDm ENGg== 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 t22si12272994eju.370.2019.06.19.22.07.33 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jun 2019 22:07:33 -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 72B251C0005; Thu, 20 Jun 2019 05:07:19 +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 RESEND 3/8] sparc: Start fallback of top-down mmap at mm->mmap_base Date: Thu, 20 Jun 2019 01:03:23 -0400 Message-Id: <20190620050328.8942-4-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190620050328.8942-1-alex@ghiti.fr> References: <20190620050328.8942-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 Thu Jun 20 05:03:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11005849 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 3CBEB112C for ; Thu, 20 Jun 2019 05:08:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 293B02847A for ; Thu, 20 Jun 2019 05:08:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1535028488; Thu, 20 Jun 2019 05:08:46 +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 A27642847A for ; Thu, 20 Jun 2019 05:08:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D39C66B0005; Thu, 20 Jun 2019 01:08:44 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CE9A08E0002; Thu, 20 Jun 2019 01:08:44 -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 C00878E0001; Thu, 20 Jun 2019 01:08:44 -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 745986B0005 for ; Thu, 20 Jun 2019 01:08:44 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id m23so2578831edr.7 for ; Wed, 19 Jun 2019 22:08:44 -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=Ejgwr/VlByjms82+69sXB2nR2qPip5W3YbiaXb9bhzD5wT0P7oiuRRd4bgbLglbgvP dRUDTBfQAsEemeTXO9c5PDtUtEeGzVmE1xqOFpWlM/BVBJyHPoGFmecyw3yUhh8JBfjC Y3WQLs8HSIYKAR5oKfyplCKEmpPM4YK256X51oIMwid8z0K+hgYUjE+bzzK6y/GHJ9tZ ndVRf/4p7j62WPOFiquYW37cxzobF91F+ld4FksalrC29Q1kKLtqttV94MxJ2u/TtkiO H/h4ZAvXs0XHGLZXSYsZw1W/2Uy5KzHWcAPcpZYSGUqebhpNSV7rAw1KnrbZHoIOR87J 2szA== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.193 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: APjAAAWgkUpIo+YhSe+iPkwbYBWdbfBUubWW0zq+ONEz3UVoRLSaWq/6 nidbyfsCcvE4lRT1fcxKjNw9Ab2b1YpxcMpw93LpsKHvLeqfJWMJFOD/3NPzXhWUnrlxoO2lhla 1JpNX7QslIShbGMr9OF9GaG6XD5e55rKnBD2JycYrXBZhVWRlTJKjpNEi93zokSo= X-Received: by 2002:a17:906:1181:: with SMTP id n1mr78563041eja.177.1561007323984; Wed, 19 Jun 2019 22:08:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3beSdzdWr8RBBRU3pjVr7aHnM0jAi+VWDDFM8iarQmqAvFbYInex+zBgpwdSNxcNH4Mdo X-Received: by 2002:a17:906:1181:: with SMTP id n1mr78563019eja.177.1561007323222; Wed, 19 Jun 2019 22:08:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561007323; cv=none; d=google.com; s=arc-20160816; b=BkWSPSHuS2gdmpqP93EkZRyQ5GVbrA19Idahw2CKy71XPAeQGIWGvnMg3P6WubB50t Rx6Y6lY2iEW2RXjRriS2vyV7EdZWwdTlNQGa8c0MZ0GZ94UNCFTdAPG/yMrDLgpDOIU8 SnSYdqRE7y+QrK6jYKjdGN80lSoU3F5qTSyx/VM0NU8AgIWOMCGs7ycOfI6iVI0Q5+fF yL/mKN9gCnvIEkwBEHKUKsDRkLuTuYVILR7zzriFkE3nM25TjEdHjt4hKPKAg5gvhTcU W/jONH6l2XijrYtGCdfe01qzXjVvvSLl/0UnKdKkqjTFEpCx33EZybgeZmSvRNKxN4Ji H1ow== 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=0XDI05OjG9K3rzz7GjWGcw3ps+jOD8KKFyQcjLdJMMN9y72F7H+eoULcRUOngVrw98 /vxNSG3NrEcK8RMPU5SjgbKXhnLf8JBwbJQS+12U6lFlYvFesM99MJQrA9ycZ2S11dxd REE6eEWIkFI5dHreRFgJbXr0Ed/Syy4KT1DZJ5XRiZWRU7gDuzvANB3UHNEA0e+ilq4d 9SSro+UK1OovyF/kRrVXOMrlW1zVEZ51mIgOuFTD6rnn/5wW8u2nHlW1vMtZaDj3NjST y7wxX2hUMkXKu1vH3COZG8DwraE7OjWGnwF3z6GghTcSKSZb2BBWNZqtfmev8unxlzg9 NcfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.193 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net. [217.70.183.193]) by mx.google.com with ESMTPS id v4si6990278eja.213.2019.06.19.22.08.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jun 2019 22:08:43 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.193 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.193; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.193 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 relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 08AE424000A; Thu, 20 Jun 2019 05:08:33 +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 RESEND 4/8] x86, hugetlbpage: Start fallback of top-down mmap at mm->mmap_base Date: Thu, 20 Jun 2019 01:03:24 -0400 Message-Id: <20190620050328.8942-5-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190620050328.8942-1-alex@ghiti.fr> References: <20190620050328.8942-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 Thu Jun 20 05:03:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11005851 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 817A1112C for ; Thu, 20 Jun 2019 05:10:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 711C32847A for ; Thu, 20 Jun 2019 05:10:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61E0028488; Thu, 20 Jun 2019 05:10:02 +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 EE5C12847A for ; Thu, 20 Jun 2019 05:10:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 263FE6B0006; Thu, 20 Jun 2019 01:10:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 23B5A8E0002; Thu, 20 Jun 2019 01:10: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 103218E0001; Thu, 20 Jun 2019 01:10:00 -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 B6C836B0006 for ; Thu, 20 Jun 2019 01:09:59 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id i44so2605864eda.3 for ; Wed, 19 Jun 2019 22:09:59 -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=OVj/KHGPS745QuAggwpmQZKTesc7ZY/k83eMdpTYzPuFVm7LdW9QKSq+oMijgYBTxt jevsyKAT0yUOfUb+EYvBz6IbS8mJ76UGHw6/fpcki//5yR6RQ/nAG1yuKa21xGKmu31B rc6TwPbzMsVYvKEezKDODrIHXHo9XIFcK0WCfSRf/r3hl5rDjJlnBX5GyGioGE4HVDXl Xvx7cx+EGW5be4Q/JjwWKg2HCOEe/USKlAK4oDVRDw5HyWS56DLVtqY0tAuNr4ffoK+7 FcTYzmZ/dUKCUYKEL9Lkv3xleUBAaAie5BCVNT6ZXZH1AV/7iLLR3aCV2pCpmql9k4rI Cn5A== 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: APjAAAWnL0H9AUOmodDIeuv2O3a/2Tqx531Iem51Yn8kD2LoEijYqqk8 x401N3G5EGbWAYGfhqRdSuaDGGfc4zlc6K1VkzKtgwQGZfNIqYQx5bgRTa+XbY6YUDElj3hBLSS 6IrkaiUhRjlRccVW284rRVd1NudByoWFTC3o6h0eYaVQfzTsFyslGBoLOo3lcQ0E= X-Received: by 2002:a50:b161:: with SMTP id l30mr117195912edd.278.1561007399282; Wed, 19 Jun 2019 22:09:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkEdKDSUwMh5wCzq6vITx1tq1AsGQh3umJRL9i8Ff7YZvnqxlyXGSm91KIlRlyuvmCt8R1 X-Received: by 2002:a50:b161:: with SMTP id l30mr117195867edd.278.1561007398585; Wed, 19 Jun 2019 22:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561007398; cv=none; d=google.com; s=arc-20160816; b=DzuO2CyJ/ARrjQiZAcpSjCZ80jHe2lbfyXAyfqErOy31aszkrkiQuWXbZFhLX+7X4E HVIQBIwTBCGQXhAT2HveUoX94TBngg3ehbKwfU8uIBoF38sym0ODLp7GTBQTyQ2Zt7wE AzA81MkRPDD8dgriv7iCOpeMrCHJorv9zWQMCHLxnNiQ/ktmzbOm/C/HqcyFvriweEZD jHQJWJ6TZHSR1LkO3xlOatOsjzny43b6AQYBWHfyilPxZfkwKdMZZS6CVOLPAmQHldSD G4BstymZoH0UBw09VmGjgTDIMBpa9GlhTIjxHG0fDsTyLYIHfsh1+HnDvzjmoEXvnf5b +3BQ== 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=0QXR6aLToeAqx4IoZB4zzn/x7txKH352eb6Nmj3k32f1MHrtP45xQfflauByNiWp3n UmBrju2FVypww2tB52UewtjSFrrEyaYo8S5g7w8AesBDXwoirQfXRbqQtIxM0+r3W0k6 TiEfGRuXBdrE2WjVmUm8vIbV15SytfsIZd5ikYEdTyaPd0gNbFArbKsWmsvWDZ6ONBTP /NkOnUJF114NHL2xwqOnHWX41WgHvwKc5GqEowe4TltvQ0O4brCNy/2IBxHPAU09s+53 AqWTA2kdrmxzzlY9piWJIx5ovFqonHPfpxKLb7oA0EHqM+bIytrtru9itCB9Oynl0Sv8 qGHw== 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 q16si12239275ejm.323.2019.06.19.22.09.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jun 2019 22:09:58 -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 E5FC520003; Thu, 20 Jun 2019 05:09:43 +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 RESEND 5/8] mm: Start fallback top-down mmap at mm->mmap_base Date: Thu, 20 Jun 2019 01:03:25 -0400 Message-Id: <20190620050328.8942-6-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190620050328.8942-1-alex@ghiti.fr> References: <20190620050328.8942-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); } From patchwork Thu Jun 20 05:03:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11005857 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 80F5E112C for ; Thu, 20 Jun 2019 05:11:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 726B028492 for ; Thu, 20 Jun 2019 05:11:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 662C528496; Thu, 20 Jun 2019 05:11: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=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 F3D1028497 for ; Thu, 20 Jun 2019 05:11:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 373E66B0006; Thu, 20 Jun 2019 01:11:19 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3244C8E0002; Thu, 20 Jun 2019 01:11:19 -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 239F58E0001; Thu, 20 Jun 2019 01:11:19 -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 CCB6A6B0006 for ; Thu, 20 Jun 2019 01:11:18 -0400 (EDT) Received: by mail-ed1-f71.google.com with SMTP id k15so2599123eda.6 for ; Wed, 19 Jun 2019 22:11: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=30VPFryCoEsVbaJedBbFHYEdEa2oyzBbCy4so5XhB44=; b=EFOF565SKwThkTz0CNgucOb2bRHX4e/6xFustr4SIYIVM2Xxpw0eb8suYGENHNDAXN giDkqp7MzuNxznJaZPXfLvd+CtL3xbcqkZscyZZlsB5xgcBgGutTaVSuXB/lMnCZ54rG KXmrIZS40auQOnUnX0cPOGcvmV5VEUHsFlDi7O9QD2xWn28NOQ5eB9L0imjGbyGY7rZa ZYUShuGbhKJUBQDzma0U6kkPdRthqtPwKNea7G1kv69c730llYoDEuFAHTwvjJc6yiO9 2a4zUWb8AlUBF7M+/ds2iftxS4CTAD1tqRNuFdXoJSLcfhN9QUF5MCTTw618PrOnqiQx AHsg== 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: APjAAAU05YYa64b/V1wwESdUkfbY30RYnR305Xg22WI+2U/mduBJFi2F zb7Spj9kAH2ZsBgn3lSjktRoLxClvPcet7tig84GEUwq2+n/TLLFi2DQBVfAtbyPGe0O3olAtwq JXoRCWTwGjYQtc38PdGa4Fb6+E6YWM+GRgoa1g14iN45Ue4R0UGvga15h08HfovI= X-Received: by 2002:aa7:d5cf:: with SMTP id d15mr81421138eds.67.1561007478367; Wed, 19 Jun 2019 22:11:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQA94YNA+PlEMbxD9VySoLd20wQdpcQYni+O/uFyelqfzmEQzolfxM14igRPyB6ENFVefF X-Received: by 2002:aa7:d5cf:: with SMTP id d15mr81421086eds.67.1561007477648; Wed, 19 Jun 2019 22:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561007477; cv=none; d=google.com; s=arc-20160816; b=qv/Uo2NdUJKGnD8O4QkP8UnOfp2OjVbHpKK/dlsVbKXcXinTw84jhXmSSpJCBM8YMw MobdraRMP2UvhMDiLVxZACPYdpY/jTpV/W7qNGHbbfkAo7VK/XiyeQTtp4qC0SLXxW95 ORLj7p6x5bxXQ69T8KT/JEL98QpJEv/KpzaxoiaeUnvifm686MEddNYp0nUYFs30PJCl rzKvY+l0eef2uWAdexic2Ab1Nm7RSj2kE7CkDC3VpB8l2FcuohhdDPuwMAHCjkF1ci7D UvV9ebq+70/UbJD7E6rcidFsFFLgsAV0+59CcfQ2SyBQZmXQQmSf0MJZmU5XU2yJOgAE Imzw== 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=30VPFryCoEsVbaJedBbFHYEdEa2oyzBbCy4so5XhB44=; b=xMOeEVch7QzpGiHDutG7PmONtUtDP2JOr/otEF4ICm87lrEHCZkgYf43jqBCSwiJDW FqAQPv42KjOZChPeZf+2UPC6usa2hUPuPDuHOGeZPNCztgq9tm8c68dG0cIPbb476Bcr rNZS8OfVre2whz7/HJJzxbReDSiu/CZ+MXIOnrNAB7mqt/whG19qFYQSXB6emXqwhfkG UVHYwv5GidySMf5RZZEuyeXXKxRyF4OCaUPPSuP8dDVySRx/CCbxNvPsWddKChb5lf2H 8PrAyz8clVWTPktpW+nMigAnM9jHSW7FPuE8T9cj33yMOGd2onhXTfnSS2EI126FnYNb GbpA== 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 z14si3816520ejq.189.2019.06.19.22.11.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jun 2019 22:11:17 -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 6AFE360006; Thu, 20 Jun 2019 05:10: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 RESEND 6/8] parisc: Use mmap_base, not mmap_legacy_base, as low_limit for bottom-up mmap Date: Thu, 20 Jun 2019 01:03:26 -0400 Message-Id: <20190620050328.8942-7-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190620050328.8942-1-alex@ghiti.fr> References: <20190620050328.8942-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 Bottom-up mmap scheme is used twice: - for legacy mode, in which mmap_legacy_base and mmap_base are equal. - in case of mmap failure in top-down mode, where 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. Then this commit removes the usage of mmap_legacy_base field from parisc code. Signed-off-by: Alexandre Ghiti Acked-by: Helge Deller --- arch/parisc/kernel/sys_parisc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c index 5d458a44b09c..e987f3a8eb0b 100644 --- a/arch/parisc/kernel/sys_parisc.c +++ b/arch/parisc/kernel/sys_parisc.c @@ -119,7 +119,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, info.flags = 0; info.length = len; - info.low_limit = mm->mmap_legacy_base; + info.low_limit = mm->mmap_base; info.high_limit = mmap_upper_limit(NULL); info.align_mask = last_mmap ? (PAGE_MASK & (SHM_COLOUR - 1)) : 0; info.align_offset = shared_align_offset(last_mmap, pgoff); @@ -240,13 +240,11 @@ static unsigned long mmap_legacy_base(void) */ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) { - mm->mmap_legacy_base = mmap_legacy_base(); - mm->mmap_base = mmap_upper_limit(rlim_stack); - if (mmap_is_legacy()) { - mm->mmap_base = mm->mmap_legacy_base; + mm->mmap_base = mmap_legacy_base(); mm->get_unmapped_area = arch_get_unmapped_area; } else { + mm->mmap_base = mmap_upper_limit(rlim_stack); mm->get_unmapped_area = arch_get_unmapped_area_topdown; } } From patchwork Thu Jun 20 05:03:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11005863 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 0F70C112C for ; Thu, 20 Jun 2019 05:12:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0170928492 for ; Thu, 20 Jun 2019 05:12:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9C06284BD; Thu, 20 Jun 2019 05:12:26 +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 60CEB28492 for ; Thu, 20 Jun 2019 05:12:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B3B526B0006; Thu, 20 Jun 2019 01:12:24 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AC5F68E0002; Thu, 20 Jun 2019 01:12:24 -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 965DD8E0001; Thu, 20 Jun 2019 01:12:24 -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 458D26B0006 for ; Thu, 20 Jun 2019 01:12:24 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id b12so2572597eds.14 for ; Wed, 19 Jun 2019 22:12:24 -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=38aPMSE0cd9+t8GyN9A5LNY8mTJqABB1k8K8E77COyE=; b=OSDhXTEhW34ZSFv0Hc2/ddYz1mcdwhHuAtsgUF7rsSDn6ABddcuRX/eJMKRbkUdJNI n8v3hJuGyI4jhpx8ygz6VEu236eV6L9yxxAv81L3riOAdEkM6ansprCsaiPRWV/LRXvO kLTt69mjzpTnOsxXz4lBBsJlfXwDHxXRTHgtFcccVIdCCxZgTteZvx7s1R8weHYILqBG DnQYZmbpWgYNrxJIvFl/HpFCa/IZ9mzZqOn2RWwkf7kTEqa+vaLFm8rPPYPBb+0CpIy9 TlqTNQExI2OjLxydu5a+uf6LspLQ9AW285OKBK7dWJyf9FhkbhhIEgyQwPmV/VToUceO HA5A== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: APjAAAUNA/tqFvOBTAs0nP5+LI3yums8N3Mqrrfc2siqxmSq3+O7HvPB dx8pWkRl6uCLfyDV6+mlxoAZkkFuNNQoClon2ezw3AZW2WqnZpfCzj6ZYSm2Q5KHD4MRr6FO+Th 0I64XXFuA0xyrpWOimQVSr5JhI9GZHPszpqh/byOp4EaXoIzvNmMl6wLNt9behXU= X-Received: by 2002:a17:906:3382:: with SMTP id v2mr72940865eja.25.1561007543758; Wed, 19 Jun 2019 22:12:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5dS72s3QsJtJo16ngrtaIPuwFvXlmLZBIVf8gDQKG1pn/cCpBAXell2B2rWzCurjhFcSm X-Received: by 2002:a17:906:3382:: with SMTP id v2mr72940814eja.25.1561007542722; Wed, 19 Jun 2019 22:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561007542; cv=none; d=google.com; s=arc-20160816; b=sbNXXkduAHTxuZej/Na4zfrA8BwAtZIIaHSoBFTtE0g5oiqaj5pEXYXDtlIdRJgdTi Ecu+17mEddaQ4Q1nknrFtE+jX/RX2vFO6t0dLJoyBvrpP/2up1SVxhr2e0eWg2Z9Zir3 buuXautLvW6SYQamCAlWPmeTQWA1xiqxXVlbbm4xp5bftsp/k7Ru52yAJk9RcFzwaypy v5W7BKcIHdWtz+8BSn/0EVlEh+x0rbOZSFsGOYCq0XKdWE2wXzcMLslR6unV1QL4SKlX 9cEfBcqkqha3e0z9UgTqs7Uhcj4qFQxaRHErMKEUiLw8EO3WevoTKguOaXAvnUBtGUxH isLw== 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=38aPMSE0cd9+t8GyN9A5LNY8mTJqABB1k8K8E77COyE=; b=xlA97o7Ro1kN0bIoNGYtXGtoQaNOiOcVxlUCd2IBkhJ5+/qUBPrK1SRRXsMJcmCWZE v22MU7dik6RZayaiOnI8VvxHZKl3gEAsG2mSqzBw4IxQS+iiYVfLxXEfa44Mcgbh21Xh O8BcZKS7CZLTbz8/AenZAQcmk5HYa2Z/rWHnRYqDReSVaBS+3uTMtDer5URtfVfriyI4 2BXizwaPlHHVb6siwoaQOqotFZfAQFvY+DUrPYEq44+lx0vKlmgwdO090lL5AwS8jHlS AoWaA3eUWZBN8zFVTbTlXdLsjPhKEv/DGQ9Axg+oUmpLW6oY7Kemu8sYZYehKK7WVWWJ sJhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net. [217.70.183.198]) by mx.google.com with ESMTPS id p5si7261242edh.409.2019.06.19.22.12.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jun 2019 22:12:22 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.198; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.198 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 relay6-d.mail.gandi.net (Postfix) with ESMTPSA id B26EDC0005; Thu, 20 Jun 2019 05:12:17 +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 RESEND 7/8] x86: Use mmap_*base, not mmap_*legacy_base, as low_limit for bottom-up mmap Date: Thu, 20 Jun 2019 01:03:27 -0400 Message-Id: <20190620050328.8942-8-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190620050328.8942-1-alex@ghiti.fr> References: <20190620050328.8942-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 Bottom-up mmap scheme is used twice: - for legacy mode, in which mmap_legacy_base and mmap_compat_legacy_base are respectively equal to mmap_base and mmap_compat_base. - in case of mmap failure in top-down mode, where 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. Then this commit removes the usage of mmap_legacy_base and mmap_compat_legacy_base fields from x86 code. Signed-off-by: Alexandre Ghiti --- arch/x86/include/asm/elf.h | 2 +- arch/x86/kernel/sys_x86_64.c | 4 ++-- arch/x86/mm/hugetlbpage.c | 4 ++-- arch/x86/mm/mmap.c | 20 +++++++++----------- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h index 69c0f892e310..bbfd81453250 100644 --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h @@ -307,7 +307,7 @@ static inline int mmap_is_ia32(void) extern unsigned long task_size_32bit(void); extern unsigned long task_size_64bit(int full_addr_space); -extern unsigned long get_mmap_base(int is_legacy); +extern unsigned long get_mmap_base(void); extern bool mmap_address_hint_valid(unsigned long addr, unsigned long len); #ifdef CONFIG_X86_32 diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c index f7476ce23b6e..0bf8604bea5e 100644 --- a/arch/x86/kernel/sys_x86_64.c +++ b/arch/x86/kernel/sys_x86_64.c @@ -121,7 +121,7 @@ static void find_start_end(unsigned long addr, unsigned long flags, return; } - *begin = get_mmap_base(1); + *begin = get_mmap_base(); if (in_32bit_syscall()) *end = task_size_32bit(); else @@ -211,7 +211,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, info.flags = VM_UNMAPPED_AREA_TOPDOWN; info.length = len; info.low_limit = PAGE_SIZE; - info.high_limit = get_mmap_base(0); + info.high_limit = get_mmap_base(); /* * If hint address is above DEFAULT_MAP_WINDOW, look for unmapped area diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c index 4b90339aef50..3a7f11e66114 100644 --- a/arch/x86/mm/hugetlbpage.c +++ b/arch/x86/mm/hugetlbpage.c @@ -86,7 +86,7 @@ static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file, info.flags = 0; info.length = len; - info.low_limit = get_mmap_base(1); + info.low_limit = get_mmap_base(); /* * If hint address is above DEFAULT_MAP_WINDOW, look for unmapped area @@ -106,7 +106,7 @@ 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); + unsigned long mmap_base = get_mmap_base(); info.flags = VM_UNMAPPED_AREA_TOPDOWN; info.length = len; diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c index aae9a933dfd4..54c9ff301323 100644 --- a/arch/x86/mm/mmap.c +++ b/arch/x86/mm/mmap.c @@ -113,13 +113,12 @@ static unsigned long mmap_legacy_base(unsigned long rnd, * This function, called very early during the creation of a new * process VM image, sets up which VM layout function to use: */ -static void arch_pick_mmap_base(unsigned long *base, unsigned long *legacy_base, +static void arch_pick_mmap_base(unsigned long *base, unsigned long random_factor, unsigned long task_size, struct rlimit *rlim_stack) { - *legacy_base = mmap_legacy_base(random_factor, task_size); if (mmap_is_legacy()) - *base = *legacy_base; + *base = mmap_legacy_base(random_factor, task_size); else *base = mmap_base(random_factor, task_size, rlim_stack); } @@ -131,7 +130,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) else mm->get_unmapped_area = arch_get_unmapped_area_topdown; - arch_pick_mmap_base(&mm->mmap_base, &mm->mmap_legacy_base, + arch_pick_mmap_base(&mm->mmap_base, arch_rnd(mmap64_rnd_bits), task_size_64bit(0), rlim_stack); @@ -142,23 +141,22 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) * applications and 32bit applications. The 64bit syscall uses * mmap_base, the compat syscall uses mmap_compat_base. */ - arch_pick_mmap_base(&mm->mmap_compat_base, &mm->mmap_compat_legacy_base, + arch_pick_mmap_base(&mm->mmap_compat_base, arch_rnd(mmap32_rnd_bits), task_size_32bit(), rlim_stack); #endif } -unsigned long get_mmap_base(int is_legacy) +unsigned long get_mmap_base(void) { struct mm_struct *mm = current->mm; #ifdef CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES - if (in_32bit_syscall()) { - return is_legacy ? mm->mmap_compat_legacy_base - : mm->mmap_compat_base; - } + if (in_32bit_syscall()) + return mm->mmap_compat_base; #endif - return is_legacy ? mm->mmap_legacy_base : mm->mmap_base; + + return mm->mmap_base; } const char *arch_vma_name(struct vm_area_struct *vma) From patchwork Thu Jun 20 05:03:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 11005869 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 D3D24112C for ; Thu, 20 Jun 2019 05:13:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C363E284BD for ; Thu, 20 Jun 2019 05:13:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B76A2284E8; Thu, 20 Jun 2019 05:13:31 +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 25192284D1 for ; Thu, 20 Jun 2019 05:13:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34B656B0008; Thu, 20 Jun 2019 01:13:30 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2FB8E8E0002; Thu, 20 Jun 2019 01:13:30 -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 175B88E0001; Thu, 20 Jun 2019 01:13:30 -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 BB2206B0008 for ; Thu, 20 Jun 2019 01:13:29 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id b3so2539684edd.22 for ; Wed, 19 Jun 2019 22:13:29 -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=1r8du5rzM3WoefU9HQ0cQWK6fVdukLsqJtmhoiFPfns=; b=ZfO/y2jF4jl0ERoZ7401Tp4IegEJoRnz7VuxXbbAlw+IsqpUL5G4eqZe6LU4prlxjO mTODUvep8dF9cCCo2TeNAAgbo3gphEZahdOEhiUzZBJTE44Fqj8A0TyrBpR8UesfGmPW dzW98z3cCUnwY+idcpX2js5Tf6cZJaRQgCR4U8dPUmPi7qY2jU4obA72Uwlrjrcy7Z0j H5LKMN3KCDRyP4MsNAKeyDQs7jfMkYxxmNH7aTn+tPl4OQsI/3Lf7lx3Y2vgRY+D6biU s2PjU3nhHomr9BCAva2pHdlTkcnxeoLaFmM9LrtDlasz7chl7AmgqmxoDRCVKFb8biOP SilA== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.193 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: APjAAAXv9h6aXS7HJ3VNs+cPl/iKgC4Tcnb9GPYZhnNSytZnNMUxXhsk y2aV33MEZ7Roi6L6gucl5nKh1OYnfLO30fSYS8GTE0Poiao4UKovTn/H0Jz1kV9sKjq2gja1Qf5 bU5xZ1NtlJS/5qaJOQgKSrqJ/k87oma9qpyLT4VcvrHvtGgn9g4NukF9/yu6gq2s= X-Received: by 2002:a50:b147:: with SMTP id l7mr84833484edd.65.1561007609301; Wed, 19 Jun 2019 22:13:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9Zen9HBvaT9MWNSuDhD+Gr/EfdblwSunbdBBIVBibwlDDbiCzjSdJqMvruEI67OuLBY8E X-Received: by 2002:a50:b147:: with SMTP id l7mr84833410edd.65.1561007608248; Wed, 19 Jun 2019 22:13:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561007608; cv=none; d=google.com; s=arc-20160816; b=gPPOGCcE5/k9Xrzx6tjOIxsXO3AwDh4DQ8jUVdrF9cYbPSB7YE2ckUw+auf0WpDDyV grIB7qtEwcdiidPsCJpkKnuk+m/s5QCdxA2JhK1uk4jfpiNPyazb8h5l9ytWNLaz6ZUV YDOSWKbPy7ne5yBAF6j7oys1MJT6sZERnGbex+BrmQfEbVMzXEtTWdF8GbEnPF6fq5ch rx9j+8fIU2uTUIEJn+sVITLgxiEJdjmoTWFjqH+RTro1suKAOs9bie8TeTUjvucr2Hvv 4tgS2GLB5mlPPDAdqtViNobIcwK/nxJpTYw0rKpTU3yJJV6CN3QpwY08Pl5BJUIZY1rS QKTg== 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=1r8du5rzM3WoefU9HQ0cQWK6fVdukLsqJtmhoiFPfns=; b=pJCoIPr82h6jlGBLcx76kKu1kY7xP6yCIZp3T16DkhByGj67jINnYgfdcZbWXaHpQv 3C9br3jdtLbqY7pSRsG9w8J2fbssk8t8qM9aE+6ICX0Sfs3GgnTK4EqDnz19W33zP8NU eDlAuSAox8cSI7LTanOs8TEGBK8G0EVQa+MzPIew4RnndhTMpdQ8D7GOGG3CADPWXy1D H50yrMHyKEwIVyF702bUP8oW+xjHA/gvx3jGLI/x0nPPPWOZ1TBM+QyEhjbMnLUHJQHQ KVg7g39djR0uMZuK3Zh4vPh6O5Zwl3yr0Gqa+UNW3HJ6lnL74oJqlBKaKYEqcdpAvrOE 81NA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.193 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net. [217.70.183.193]) by mx.google.com with ESMTPS id hk14si4163767ejb.294.2019.06.19.22.13.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jun 2019 22:13:28 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.193 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.193; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.193 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 relay1-d.mail.gandi.net (Postfix) with ESMTPSA id CD96D240006; Thu, 20 Jun 2019 05:13:22 +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 RESEND 8/8] mm: Remove mmap_legacy_base and mmap_compat_legacy_code fields from mm_struct Date: Thu, 20 Jun 2019 01:03:28 -0400 Message-Id: <20190620050328.8942-9-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190620050328.8942-1-alex@ghiti.fr> References: <20190620050328.8942-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 Now that x86 and parisc do not use those fields anymore, remove them from mm code. Signed-off-by: Alexandre Ghiti --- include/linux/mm_types.h | 2 -- mm/debug.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 1d1093474c1a..9a5935f9cc7e 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -364,11 +364,9 @@ struct mm_struct { unsigned long pgoff, unsigned long flags); #endif unsigned long mmap_base; /* base of mmap area */ - unsigned long mmap_legacy_base; /* base of mmap area in bottom-up allocations */ #ifdef CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES /* Base adresses for compatible mmap() */ unsigned long mmap_compat_base; - unsigned long mmap_compat_legacy_base; #endif unsigned long task_size; /* size of task vm space */ unsigned long highest_vm_end; /* highest vma end address */ diff --git a/mm/debug.c b/mm/debug.c index 8345bb6e4769..3ddffe1efcda 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -134,7 +134,7 @@ void dump_mm(const struct mm_struct *mm) #ifdef CONFIG_MMU "get_unmapped_area %px\n" #endif - "mmap_base %lu mmap_legacy_base %lu highest_vm_end %lu\n" + "mmap_base %lu highest_vm_end %lu\n" "pgd %px mm_users %d mm_count %d pgtables_bytes %lu map_count %d\n" "hiwater_rss %lx hiwater_vm %lx total_vm %lx locked_vm %lx\n" "pinned_vm %llx data_vm %lx exec_vm %lx stack_vm %lx\n" @@ -162,7 +162,7 @@ void dump_mm(const struct mm_struct *mm) #ifdef CONFIG_MMU mm->get_unmapped_area, #endif - mm->mmap_base, mm->mmap_legacy_base, mm->highest_vm_end, + mm->mmap_base, mm->highest_vm_end, mm->pgd, atomic_read(&mm->mm_users), atomic_read(&mm->mm_count), mm_pgtables_bytes(mm),