From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 117B6C77B70 for ; Mon, 17 Apr 2023 10:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+u76kTfY5cmt7TtsRhnQ4nNrZiFX2L4ClteneDXMR3w=; b=i1QQpnteha/FHn pSkAL0FM4FIO4fHoXnqu6kbCGXvvZit0ugPkUm6x4pXPJgoyWO9q2Bl4ZtxMWV7exIP690B+7V+kV uXHJxVeIEuOWMDfZvQ3vxZTwGJeSX7+qEMd85pVSmRtjUS23Tts3fuiRkh5PvdUcHlc39NKxuRUcO LhAgcVrRvnfE+JSN8TuAYjtVbgNx4S1yLF42CkGWFYpHifmD5Wyn9FoU0UkO5KqvoSLlzNnSzDryp rIuoYB6pI0T6YfEMHYm2jGR2/w1O0HAe5OOjVHAjrlPd+41AY6gGWOTFJBnf2B6QaTuqhm/oX66KL zGFp/ouZDXz+cUzkc/0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1poLrM-00FhBm-2h; Mon, 17 Apr 2023 10:13:20 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1poLrJ-00FhAG-1d for linux-arm-kernel@lists.infradead.org; Mon, 17 Apr 2023 10:13:19 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C0C111042; Mon, 17 Apr 2023 03:13:57 -0700 (PDT) Received: from [10.57.68.227] (unknown [10.57.68.227]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7D12C3F5A1; Mon, 17 Apr 2023 03:13:12 -0700 (PDT) Message-ID: <1e9fa06d-3497-22e9-c5d1-7dccf7dff321@arm.com> Date: Mon, 17 Apr 2023 11:13:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [RFC v2 PATCH 16/17] mm: mmap: Align unhinted maps to highest anon folio order Content-Language: en-US To: "Yin, Fengwei" , Andrew Morton , "Matthew Wilcox (Oracle)" , Yu Zhao Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org References: <20230414130303.2345383-1-ryan.roberts@arm.com> <20230414130303.2345383-17-ryan.roberts@arm.com> From: Ryan Roberts In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230417_031317_589058_641BB4DF X-CRM114-Status: GOOD ( 17.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 17/04/2023 09:25, Yin, Fengwei wrote: > > > On 4/14/2023 9:03 PM, Ryan Roberts wrote: >> When allocating large anonymous folios, we want to maximize our chances >> of being able to use the highest order we support. Since one of the >> constraints is that a folio has to be mapped naturally aligned, let's >> have mmap default to that alignment when user space does not provide a >> hint. >> >> With this in place, an extra 2% of all allocated anonymous memory >> belongs to a folio of the highest order, when compiling the kernel. > This change has side effect: reduce the chance of VMA merging. > So benefit to per-VMA lock also. But find VMA need searching more VMAs. Good point. This change brings only a very marginal benefit anyway, so I think I might just drop the it from the series to avoid any unexpected issues. > > > Regards > Yin, Fengwei > >> >> Signed-off-by: Ryan Roberts >> --- >> mm/mmap.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/mm/mmap.c b/mm/mmap.c >> index ff68a67a2a7c..e7652001a32e 100644 >> --- a/mm/mmap.c >> +++ b/mm/mmap.c >> @@ -1627,7 +1627,7 @@ generic_get_unmapped_area(struct file *filp, unsigned long addr, >> info.length = len; >> info.low_limit = mm->mmap_base; >> info.high_limit = mmap_end; >> - info.align_mask = 0; >> + info.align_mask = BIT(PAGE_SHIFT + ANON_FOLIO_ORDER_MAX) - 1; >> info.align_offset = 0; >> return vm_unmapped_area(&info); >> } >> @@ -1677,7 +1677,7 @@ generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr, >> info.length = len; >> info.low_limit = max(PAGE_SIZE, mmap_min_addr); >> info.high_limit = arch_get_mmap_base(addr, mm->mmap_base); >> - info.align_mask = 0; >> + info.align_mask = BIT(PAGE_SHIFT + ANON_FOLIO_ORDER_MAX) - 1; >> info.align_offset = 0; >> addr = vm_unmapped_area(&info); >> >> -- >> 2.25.1 >> _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel