Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1496218ybi; Wed, 19 Jun 2019 22:11:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4i3ZqbaRyk0qwlag3x05bJrvurgoCPOnjv6CofHCX1HXVISwH17/9+ZrERS66W2eLzfYZ X-Received: by 2002:a17:902:522:: with SMTP id 31mr116421702plf.296.1561007473405; Wed, 19 Jun 2019 22:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561007473; cv=none; d=google.com; s=arc-20160816; b=Kms2X03AY67Ed8sPW9Gq8LTxKaK5qcixLWWHbixNgjs6RevO1vjKrkhmB83lFn92vk zRDYUt7OWr0A6Wo+serw7klmes69F2KcAkCEjUyiWF4QodeBPQBCYljr0byEo62L55q8 RJq617kqVHq6DmmHjjYt1Aydahdu5LCw8yWcwGCQPc4ifdwDQKeQbR75cFapKUYclklD pentwSUtu3fRpIpu0AoixAY6losBngNeuo40HLu55ToCG+Z9JJkM3ix6CRGpELu8Ouou uUTfug+3MDmOgyRTNB3em9DheftEzJm1gyfewxjg1wEYnnK8fS+hMBjCUysMgHcGYj4L 8cTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=UWpdnrbGefkQI6ssngVxJNkCRhvWsEseMpLH8MS8OO4=; b=g8rZ8LJnJJpR6gz1h+3nIZDIDW4vNCrTIErD98lFnIb0zmwqOYSb+wKKReIIEtiF3c A0bSXBgL8QjC3ro89rCeE+LQw1eggVyRLVEWQqCVTduF8NbKp+EC3twdgZczvYNcFkt4 dV8G91Fgbv2JqjDapOvoaKv1pTuPhfiUA6bVm9RwHKA5idDy73LICk6Wf+S5oAidY6eg nK0pWiRBR2T5foz5xd2/08rI0NVnTedzx7T3PZ5XShRjZ7e1tybragfZZwJUrm7dpE2P K1KloBKPx67U3YRk1DyxrD9KTdLat4udauJUno7i7HeyxuBGkHJCRahW9sIEEgV7+dYk 29Xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z12si4714400pgu.559.2019.06.19.22.10.57; Wed, 19 Jun 2019 22:11:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726727AbfFTFKE (ORCPT + 99 others); Thu, 20 Jun 2019 01:10:04 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:49715 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbfFTFKD (ORCPT ); Thu, 20 Jun 2019 01:10:03 -0400 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } -- 2.20.1