From patchwork Wed Mar 10 07:15:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12127151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64F94C433E0 for ; Wed, 10 Mar 2021 07:18:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D5A7A64FEE for ; Wed, 10 Mar 2021 07:18:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5A7A64FEE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 65FEA8D0176; Wed, 10 Mar 2021 02:18:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6378D8D0148; Wed, 10 Mar 2021 02:18:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FF558D0176; Wed, 10 Mar 2021 02:18:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id 352918D0148 for ; Wed, 10 Mar 2021 02:18:47 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DF5E5181AF5E1 for ; Wed, 10 Mar 2021 07:18:46 +0000 (UTC) X-FDA: 77903112252.16.DC5BB8F Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf13.hostedemail.com (Postfix) with ESMTP id 8FDDDE0011E1 for ; Wed, 10 Mar 2021 07:18:44 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id ha17so327079pjb.2 for ; Tue, 09 Mar 2021 23:18:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xw02Fd5jGslyp8wecok2dmw5uLswm///UDbdZiwlo7s=; b=LrLpUQyTo0H82ehHAEU6j3y40joBErwOje4Q85Yka8u+jfNdKNJYtj9cRiu8kebTgT +Zm1JbSJasAufPxNLuAil8WE1yLolVkj7Kpra4qK+2Hoz5xu3GyjtE1eNsZwU6Z+V2qi Q9eiLUyq2e3xYJx6O04usv2M8UZaFcR3JER4w+mXbujj/EKFlyIRvNBzGhnxzdNQKsjM UkT91FGT91iwWIbkyTvkSuCtjGhT5w5llniInBqhmfDr13c+5brdvarglN5TWIsy74xH Oe57BQmf3BBgXSVspNpd5Ho+b1/FKd92HfLLmesvQGulrB82wdTpGheF9WnII4Tnq4B8 jYxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xw02Fd5jGslyp8wecok2dmw5uLswm///UDbdZiwlo7s=; b=FRZhPYPhda2MDg1Tq90zICDKlGf1db13PvTw09f0mfXjDbmqzgzHN5sEMDva2j7QMw jnvgnbCxkvCzdIWLZ1EpYYqMOuh6QFhjtlbWZJP/vWeNsIOx6rG4n2zanQFrkQaoAPbt 4y8DSZL2LQL8WPSYyGiCFi8cdVgREuvTN4hp061FjADAXDx4NvkhwK3njUpBePGzqYwZ MU2Nt7WiV5gKJhI9LU2QnJrxHBVb3T9qe7beOi7eAua3n+YJQgx9Jdw8HVvboD6CMeWC RYl1I+Z3lBxMErknRC9LBErhRpl7XfK8K8m0ScjhvDWwvQpGRwB11jqYemCH1mORGuZO I0ew== X-Gm-Message-State: AOAM532CFF1TTbGY7UJsZoRBsFujUgIhHbwXtS7bhGafskegLnf3eHzU 2tvcrfykWxXp2l+jl/oyBLC76A== X-Google-Smtp-Source: ABdhPJx8yv56LOceP2OaEE0AVt0+YHszv5GN1MKsYzSi39Lovj89hxAlhCMKHBmd6niFYcXybxIzIw== X-Received: by 2002:a17:90a:e642:: with SMTP id ep2mr2178320pjb.62.1615360724393; Tue, 09 Mar 2021 23:18:44 -0800 (PST) Received: from localhost.localdomain ([139.177.225.255]) by smtp.gmail.com with ESMTPSA id h15sm2828868pfo.20.2021.03.09.23.18.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Mar 2021 23:18:44 -0800 (PST) From: Muchun Song To: will@kernel.org, akpm@linux-foundation.org, david@redhat.com, bodeddub@amazon.com, osalvador@suse.de, mike.kravetz@oracle.com, rientjes@google.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, Muchun Song Subject: [PATCH 1/3] mm: bootmem_info: mark register_page_bootmem_info_section __init Date: Wed, 10 Mar 2021 15:15:33 +0800 Message-Id: <20210310071535.35245-2-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210310071535.35245-1-songmuchun@bytedance.com> References: <20210310071535.35245-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 8FDDDE0011E1 X-Stat-Signature: 18suyw64m643dro9bk8wxem7tez3k91f Received-SPF: none (bytedance.com>: No applicable sender policy available) receiver=imf13; identity=mailfrom; envelope-from=""; helo=mail-pj1-f53.google.com; client-ip=209.85.216.53 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615360724-814048 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: The register_page_bootmem_info_section() is only called from __init functions, so mark it __init as well. Signed-off-by: Muchun Song --- mm/bootmem_info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/bootmem_info.c b/mm/bootmem_info.c index 5b152dba7344..f03f42f426f6 100644 --- a/mm/bootmem_info.c +++ b/mm/bootmem_info.c @@ -39,7 +39,7 @@ void put_page_bootmem(struct page *page) } #ifndef CONFIG_SPARSEMEM_VMEMMAP -static void register_page_bootmem_info_section(unsigned long start_pfn) +static void __init register_page_bootmem_info_section(unsigned long start_pfn) { unsigned long mapsize, section_nr, i; struct mem_section *ms; @@ -74,7 +74,7 @@ static void register_page_bootmem_info_section(unsigned long start_pfn) } #else /* CONFIG_SPARSEMEM_VMEMMAP */ -static void register_page_bootmem_info_section(unsigned long start_pfn) +static void __init register_page_bootmem_info_section(unsigned long start_pfn) { unsigned long mapsize, section_nr, i; struct mem_section *ms; From patchwork Wed Mar 10 07:15:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12127153 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7FDDC433DB for ; Wed, 10 Mar 2021 07:18:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0414C64F97 for ; Wed, 10 Mar 2021 07:18:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0414C64F97 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8A94F8D0177; Wed, 10 Mar 2021 02:18:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8807F8D0148; Wed, 10 Mar 2021 02:18:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7485C8D0177; Wed, 10 Mar 2021 02:18:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0157.hostedemail.com [216.40.44.157]) by kanga.kvack.org (Postfix) with ESMTP id 58DF48D0148 for ; Wed, 10 Mar 2021 02:18:51 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 49BF2180ACEE9 for ; Wed, 10 Mar 2021 07:18:50 +0000 (UTC) X-FDA: 77903112420.30.D19D100 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf03.hostedemail.com (Postfix) with ESMTP id BFE4EC0001EE for ; Wed, 10 Mar 2021 07:18:47 +0000 (UTC) Received: by mail-pl1-f180.google.com with SMTP id a24so8016330plm.11 for ; Tue, 09 Mar 2021 23:18:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pXWkEpHfeuofSvkF2rXCRT+BvK4vU6jK5MQilOA5vKw=; b=Tyud/GHIH0dgt6aYgsfzCiNwIEsV6xRhkJ9Q9Wwvgkm7Bz/m3taQq/EVcILyQlJ4t0 OCRXRuT/ud0hIi5IVpDkkHDNXFwGPjlUxF7P5T96YtJEXiVzicNIZ4KOA2P3iaNm/4fF 0IdJDctkPSkdIYw81XMd5u3CHTEuPPS209H4QPNt12XKGTbejKmt6vIDzvkVXbPmtfr3 xyvSljYHdZwbhybcBw28HeK+A+pALSULAC5gojHPXudQczeanLrNCzSgbktl6A8BGdJF CAj7AvFeI9TihJ42DcRj8ujsYjDnyO3Q5yvBIRg6vQRmBpCrhfabOeWaNykRUnUpAmJ+ 8QXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pXWkEpHfeuofSvkF2rXCRT+BvK4vU6jK5MQilOA5vKw=; b=D7Ih3kxajaq7gYMmZFEx+GjcRygInUpQfy6xnD5s+h3Z0eD5DID2IOwAsc+aqpVsZF h4xLU7an1Mmi7IgBBGbV8OwgP8IkDEiM6dNHk0C5HxLMrQTQz79cLUCihyX1IIkBHYoo iNDTYY48yb1c3t5EhBVhrq2ygH9uaCmg5FVThC/1g3B0fPiDYV6OqfSIRaYrKSUkn1FD w9TeK6PfrIBUQTmWWIKUBqmv78lg6sLgcjPWRHCbjekSg9TkUC7y9D05WZVYkPHlJQnT 9xTzG0+JYTq2xkUjHaoFZKdGK7ElsYBLJWvX7M2adH2vDS023F1+XVnBVIp47nUUb5ji nhDQ== X-Gm-Message-State: AOAM531b9M3nmvZAMPaZHs5UGvkrTCLBt7TouDaV5EBsT/xGJaCNO5Pa oVN33wkP73ip/kb9MRFP/8A7bA== X-Google-Smtp-Source: ABdhPJxyJ/btALuDsu0SeQYdLFebI/E042dTZnHmOxOdJsJ1TP8Y1eFAv0pn/8jZN1lc4hNkZrvUtA== X-Received: by 2002:a17:903:92:b029:e4:bf7c:cbf with SMTP id o18-20020a1709030092b02900e4bf7c0cbfmr1611247pld.55.1615360728977; Tue, 09 Mar 2021 23:18:48 -0800 (PST) Received: from localhost.localdomain ([139.177.225.255]) by smtp.gmail.com with ESMTPSA id h15sm2828868pfo.20.2021.03.09.23.18.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Mar 2021 23:18:48 -0800 (PST) From: Muchun Song To: will@kernel.org, akpm@linux-foundation.org, david@redhat.com, bodeddub@amazon.com, osalvador@suse.de, mike.kravetz@oracle.com, rientjes@google.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, Muchun Song Subject: [PATCH 2/3] mm: hugetlb: introduce arch_free_vmemmap_page Date: Wed, 10 Mar 2021 15:15:34 +0800 Message-Id: <20210310071535.35245-3-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210310071535.35245-1-songmuchun@bytedance.com> References: <20210310071535.35245-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Stat-Signature: s3py6bgz94ciw48i4k55gkhigqa1up1b X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: BFE4EC0001EE Received-SPF: none (bytedance.com>: No applicable sender policy available) receiver=imf03; identity=mailfrom; envelope-from=""; helo=mail-pl1-f180.google.com; client-ip=209.85.214.180 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615360727-765385 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: We register bootmem info for vmemmap pages when boot on x86-64, so the vmemmap pages must be freed by using free_bootmem_page(). But on some other architectures, we do not need bootmem info. In this case, free_reserved_page() is enough to free vmemmap pages. Currently, only x86-64 need free_bootmem_page(), so introduce a default arch_free_vmemmap_page() which use free_reserved_page() to free vmemmap pages directly. On x86-64, we can implement arch_free_vmemmap_page() to override the default behavior. Signed-off-by: Muchun Song Reported-by: kernel test robot Reported-by: kernel test robot --- arch/x86/mm/init_64.c | 5 +++++ mm/sparse-vmemmap.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 39f88c5faadc..732609dad0ec 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1575,6 +1575,11 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, } #ifdef CONFIG_HAVE_BOOTMEM_INFO_NODE +void arch_free_vmemmap_page(struct page *page) +{ + free_bootmem_page(page); +} + void register_page_bootmem_memmap(unsigned long section_nr, struct page *start_page, unsigned long nr_pages) { diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c index 60fc6cd6cd23..76f7b52820e3 100644 --- a/mm/sparse-vmemmap.c +++ b/mm/sparse-vmemmap.c @@ -156,16 +156,21 @@ static void vmemmap_remap_range(unsigned long start, unsigned long end, flush_tlb_kernel_range(start + PAGE_SIZE, end); } +void __weak arch_free_vmemmap_page(struct page *page) +{ + free_reserved_page(page); +} + /* * Free a vmemmap page. A vmemmap page can be allocated from the memblock * allocator or buddy allocator. If the PG_reserved flag is set, it means * that it allocated from the memblock allocator, just free it via the - * free_bootmem_page(). Otherwise, use __free_page(). + * arch_free_vmemmap_page(). Otherwise, use __free_page(). */ static inline void free_vmemmap_page(struct page *page) { if (PageReserved(page)) - free_bootmem_page(page); + arch_free_vmemmap_page(page); else __free_page(page); } From patchwork Wed Mar 10 07:15:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12127155 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 182B5C433DB for ; Wed, 10 Mar 2021 07:18:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A5AF464FEE for ; Wed, 10 Mar 2021 07:18:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5AF464FEE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 415F28D0178; Wed, 10 Mar 2021 02:18:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C5738D0148; Wed, 10 Mar 2021 02:18:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28E138D0178; Wed, 10 Mar 2021 02:18:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0226.hostedemail.com [216.40.44.226]) by kanga.kvack.org (Postfix) with ESMTP id 0C31B8D0148 for ; Wed, 10 Mar 2021 02:18:57 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C1398181AF5E1 for ; Wed, 10 Mar 2021 07:18:56 +0000 (UTC) X-FDA: 77903112672.02.9F01914 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf16.hostedemail.com (Postfix) with ESMTP id EC9148019144 for ; Wed, 10 Mar 2021 07:18:55 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id ha17so327297pjb.2 for ; Tue, 09 Mar 2021 23:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hIA/QB2KU+rrzZfq152LcTIhO8HMik78jGjN3khGL2w=; b=vz2ANmllNrB/6zQ9cHOSxTTl8EVWr8HiijV1nbwR/L0G7Z1gsPxSgS5CY2R9mA1izi MWZuURk1fl7leO2hdYc3lGNOTHROW53XdZCojj80ctOKedD0uJuEX/uzOb1GPlah9DEK FC5eiKETAaCYD0sFveY1tzmALg3F9ux6F+nd790OK3crxRek97CJQ7CFiZiKRioARWRk v/XXyyx10LsMyZ6DQjx/6Rs6b3rxfXoZJbo7isYy/d2bvxafS4y7ZuhvRyDI53qoBKkv zossrebZe9rEq6Ym8OP54i0Qvt5nui64C8yKdBnVYMXE9d/MgkN5eA87yqfl84Xq5WRJ kq7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hIA/QB2KU+rrzZfq152LcTIhO8HMik78jGjN3khGL2w=; b=asHmO3+zDstyHLjCKWqmq+3/dqJDBDCLLGy+G8DDE3g/LBGyyOG5taex0SjPAud+oJ l/bvyAAyoLDn7oRimps86S0F0frfd+uuJjgnjjKELIjzhkRhnX5pJPlv6GL+e1Po1X3L 0SdIUMD6qj3e4QsE9Zk/TnR0W0JXYeJpeH1GW7a11VS30u3F5BK9LtiYHAMKTirJnUNf iPcP1xZcj+qHGCOmITEA24zwg4N2PgaCXZLiWh10rmA3am0IUIpdbBq/oIIzcQ1XE7HS IOak0FJdfz3BSll3SfOktoPWyfl4RyfuIGj5i1O0V0yXjIJK7MKep5fX5uHJMdoeEmdx 1LkA== X-Gm-Message-State: AOAM531FUeDguWeRceOOHMh11yhRojQbnFi5KmsaXDnYJmdcv1hVOChD PDPZA240WYj++3rnhkqBkjKlXg== X-Google-Smtp-Source: ABdhPJwowWjHya3/6Nc15zurktLPm17MKjE9NrlSzAz5tNvj1VTRUBM73Bxtm4hu/RA+iDjyEo8a6Q== X-Received: by 2002:a17:90a:6e44:: with SMTP id s4mr2058884pjm.112.1615360735426; Tue, 09 Mar 2021 23:18:55 -0800 (PST) Received: from localhost.localdomain ([139.177.225.255]) by smtp.gmail.com with ESMTPSA id h15sm2828868pfo.20.2021.03.09.23.18.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Mar 2021 23:18:55 -0800 (PST) From: Muchun Song To: will@kernel.org, akpm@linux-foundation.org, david@redhat.com, bodeddub@amazon.com, osalvador@suse.de, mike.kravetz@oracle.com, rientjes@google.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, Muchun Song Subject: [PATCH 3/3] arm64: mm: hugetlb: add support for free vmemmap pages of HugeTLB Date: Wed, 10 Mar 2021 15:15:35 +0800 Message-Id: <20210310071535.35245-4-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210310071535.35245-1-songmuchun@bytedance.com> References: <20210310071535.35245-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: EC9148019144 X-Stat-Signature: sd6ue8kgw9baby5zihoq6zokzswosjw5 Received-SPF: none (bytedance.com>: No applicable sender policy available) receiver=imf16; identity=mailfrom; envelope-from=""; helo=mail-pj1-f43.google.com; client-ip=209.85.216.43 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615360735-766055 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: The preparation of supporting freeing vmemmap associated with each infrastructure is ready, so now we can support it for arm64. Signed-off-by: Muchun Song Reported-by: kernel test robot --- arch/arm64/mm/mmu.c | 5 +++++ fs/Kconfig | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 3802cfbdd20d..6051a120c906 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -1109,6 +1110,10 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, pmd_t *pmdp; WARN_ON((start < VMEMMAP_START) || (end > VMEMMAP_END)); + + if (is_hugetlb_free_vmemmap_enabled() && !altmap) + return vmemmap_populate_basepages(start, end, node, altmap); + do { next = pmd_addr_end(addr, end); diff --git a/fs/Kconfig b/fs/Kconfig index b5dcc68aab25..d90860135844 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -239,9 +239,9 @@ config HUGETLB_PAGE config HUGETLB_PAGE_FREE_VMEMMAP def_bool HUGETLB_PAGE - depends on X86_64 + select HAVE_BOOTMEM_INFO_NODE if X86_64 depends on SPARSEMEM_VMEMMAP - depends on HAVE_BOOTMEM_INFO_NODE + depends on X86_64 || ARM64 config MEMFD_CREATE def_bool TMPFS || HUGETLBFS