Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp260749ybi; Tue, 18 Jun 2019 22:15:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqw19t0j20ZPeM0QZ+oZ+iItursX/fGIQ9e3PEPoDQkH729HspHQIl5uSZSEd8CTCwLLa+7Q X-Received: by 2002:a17:90a:1c1:: with SMTP id 1mr9259788pjd.72.1560921333060; Tue, 18 Jun 2019 22:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560921333; cv=none; d=google.com; s=arc-20160816; b=JXd16QrTnD6GWG2snMrOS8eOvFKlBalqInUTjChbE7a7ZuIdBhAHDx85RtWunnM9Jj Ct6sVycm2wx5SzIfT7n8l8xrN53/OsSehRpxoI5cYh0DcEBcdQkmTX+N+jhTxfRsKrjy 1nPjAXudTD9HBxaFTLy2yejed+wAOkltxY1gWpNwNza8T89Rgyl0mXDY5lXj82c6FdgQ hQ21W6t2LFuViLEsRXHTMLcPrjb0xP42HOpagD+1uEjuuFankYfb/aHy9a2oSwcE7FA4 5HB56H7wa2fJmn2cyv2w+9ssXf2VU8gCVmMQc0xIA+NJBPjHzzQsGy8By0o990UvJL0H TfAw== 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=Qxtcr3zP1n1CKdB3QG6FMmftQY85qPT8l9OAVutF+d3dZaE/0wwjh1+rlMJFuNzNV5 H3C9i5Ixq2z/RryzaYs0tFt3PoIs3vt8U2/MVviv1WlbiZuARW+h0X5ocKtOeD5dQahT 1P69ODq9VfTCPa6rkZ0wINGSm1ueMxLinIHPjYmh+W3x+sIx0ZUEKsLo36LW3Q7Y6zm8 59U8TWPsWsI24ng5YCMU6b2F805/sCVxK1mg/xYMdakNMTjmIi1BF7qLdJzHHo3GWRUa Cv7JHu5s6xGsQXHe296Emb11XxCnCsFJWB3+5h7JbI++tWsre865yq6qsYHaT+2SkjJ3 O3Kw== 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 v204si2086560pgb.80.2019.06.18.22.15.17; Tue, 18 Jun 2019 22:15:33 -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 S1730756AbfFSFPF (ORCPT + 99 others); Wed, 19 Jun 2019 01:15:05 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:48277 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725854AbfFSFPE (ORCPT ); Wed, 19 Jun 2019 01:15:04 -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 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 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