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: 12127159 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 B6FC6C433E0 for ; Wed, 10 Mar 2021 07:23:11 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 341E064F89 for ; Wed, 10 Mar 2021 07:23:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 341E064F89 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gV10sg/4nXPvkDxEbvobnCj0SMQILY/fMYyMo+EyAfQ=; b=LV+pn0IXabqZjvVp3lVwBnGLD 6va9NVn9mEDDFXio0N9qeFheuKVvP7Z7LiDc10TEPKX205tHhDFviqcpA5HiOKZ4oQUC5vh1zVLy5 gEgFk/vvXQgWKS1buFZQsTQtM9C92WhKJ/2+ChWtfbl6vbQFbVev/7S+cXsh0QiCr0BR7H047p6mi gqVM/KaDtyPXQh7waxduCEnBgD18xstEsVEnxNg1VBYfyWovmmE4CRjvNCQrXQy3Gq8mM6S2JO1pp sdGdY+8NaziD0+O2QeIQazUbX0Rso9Ust/4tBQtP2E0lhytUhN0ylnoGc185I5PgpHYTCBC0mzhpc I9KHFgohw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJt80-006CQH-CH; Wed, 10 Mar 2021 07:19:32 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJt7F-006CKS-QP for linux-arm-kernel@lists.infradead.org; Wed, 10 Mar 2021 07:19:04 +0000 Received: by mail-pl1-x631.google.com with SMTP id a8so1519517plp.13 for ; Tue, 09 Mar 2021 23:18:45 -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=mxR8eoRPubujGO/KkhSXSgdMG9iy8/NpVLOQR0XamFRHwZ8U2dGLCIKkN5spPzrw7V fdaZWpA/1VzFmlujW9QsmH3WJoo77+xEkj9vPygPQCYVL061SI4OAq6VfdHPdCZXMsNy rMdU7nC7Is5c9fE+VD4pF9JS48V1MN6om8Ha8jpdGJAlnWu+czuRW8qU33miHE/ZARWe RCvoYIrcrDibuqjyyKmLLa1PzmLikvtD1vIK/UJTO7nsgTbvl/NkpXd0zEzxjRZt2t77 0lqI3vVDYKemQWHTdsz4NvXgPPxHt2ZTDhtGfxppNjEb+wzoEmhh1hPvTcKA7YWvbTZE HdIQ== X-Gm-Message-State: AOAM531UkBODd+hIW5a9Mbcx1m/YHhXrOUiDCbf/O4pyZrFm+BaPwRTk XnI5bnnjW3E0p2cHPJnsePCgWQ== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210310_071859_926484_929D9D6F X-CRM114-Status: GOOD ( 12.99 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: 12127157 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 E1B15C433DB for ; Wed, 10 Mar 2021 07:22:21 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3532A64F97 for ; Wed, 10 Mar 2021 07:22:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3532A64F97 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NFRPskNlCc+ykrcZuoPqtczGtBQWlYAWz+dHbwjF/0Y=; b=NLaIuaIvk0nOWX9aVKpKKgi3U RF85Zpgu4Bx6lYMn+lKFYTQ8IQMY0fYwQI68vZHTJLqSnl9wAAwnqnqX8EaPB6fVPMXGBTY7E3k6q Dt8DchJ/AT2OGHZzsg4N5szy67OlF0TLwSzCSLsqmW0BTA81Cb2+UlZ32kJDcrTo7OI/xMMn9VEiy e/cgMBrKdLzyxWH2/BenU7/ORg+c2aLr64Yz3o9/7PV8iiEfwWZEt7nahw/roXQEx8n9lBxmxKmxm R8lxFGdgZOKPlEcnllbN6nlkwReHK6O8jRMaEBvuOHwoouSVCN9hZFp5PlG2nyinii/gglEPs5KbD ho74ytkWg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJt7d-006COO-O8; Wed, 10 Mar 2021 07:19:09 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJt7K-006CKV-Ch for linux-arm-kernel@lists.infradead.org; Wed, 10 Mar 2021 07:19:04 +0000 Received: by mail-pj1-x1030.google.com with SMTP id kk2-20020a17090b4a02b02900c777aa746fso6980555pjb.3 for ; Tue, 09 Mar 2021 23:18:50 -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=X5PdkZFydsO41l3e+2/kz5wO2rcOXKCe68VNeQkVzotFD5cJ4O3mE67rjHQMuPA5Vd TCfop67VSIXqWXMmlHHnzw5Y69JGhQasR8JKtaBWneKD8AIf6fPBU/+2ttQ4g/rwHAcS Kj20tZYJy2ngo9FJ/1H5ifasYPAQ7XCc9/9TVoGd6di+qFcSb4BzgqBnQQXNSlzdpPYN YVYZ3QiTiCc8o0TR/Hj9BUCXOF2s5hnQJ70PoxieYCuxZMHeKxl+vVChxGvdSYgNWPCu PdclRnsBxHIl5ohn0QXTzlUaEE9HFXXX3GXaxSaSuNFGOA6JVaNfeeQH0YMru0Us29s8 KmrA== X-Gm-Message-State: AOAM533Q1+NEkAfQt99+2ZMJHaYZEC3oWwBVitacercJSI8M+6s1TNcC FzLWHbNAhrBgjATjnToF/qpTpw== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210310_071859_920376_D228B424 X-CRM114-Status: GOOD ( 15.24 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: 12127161 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 54AEAC433E0 for ; Wed, 10 Mar 2021 07:23:19 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4E9D64F97 for ; Wed, 10 Mar 2021 07:23:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4E9D64F97 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=A27i125S9FBtpvAtj5YcEYLxcmy2EBOC819zEE9s5qI=; b=nrp60oSeuN+7lKC2cfQsCoHkx YIT9ICoJp+i4ZT9tmkmuSzvw4LMg2OO0BIr8sbsk1EGAR8abm8wbhtHtsHv1CsAfTl24qngqvY/WU bE6ZwEkpaLoBQDZrErl/rJ2yQ/oorvP67WVDNLKCipIw4paZ+PZY77ej+ZDkwmVIrRW9sBR9cMizD 6XJFH667ox95sfEYlt/jz//WcF8a1Bex7VkgzPCzgO/w7BUyWcCio9TsUyFg0EqTMdY5bOctoV8EJ AoIgzXyXu+WjOMzEbMie+skYreSWV/kXzGdE9nw+HPKh+GUyOoqPtzimz2+Dlz9NpJLcTw+ZYg6uV O09XhrMEw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJt89-006CRc-MN; Wed, 10 Mar 2021 07:19:44 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJt7Q-006CKv-Or for linux-arm-kernel@lists.infradead.org; Wed, 10 Mar 2021 07:19:04 +0000 Received: by mail-pj1-x102f.google.com with SMTP id bt4so1086623pjb.5 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=AN8OoH1u/U+NSJfjf5Yt/ZFnhRdNKZxSD+F8sLTj+ecaQ9aqz4HLluH3s2VFybgrJx cLGh1jARdma6H9DNeDPOUgbHq5RREViJ2RsYb64cA8zyCTldJyXv7ch7fMvt7L8Rdc9f Y4sYZtxVpSF2VVdJjtfafm0AaJ3YH5qZ2P0k6GyFuzz6e/zJGsV3yKU0GVtjIgwpJs5c OOp2EM4kV6S6pEdAjmpwaP92Op1/xOmn6nfs8hW3cAtcwaTU3M2D4m0fr7jogd5Wbjnh ta09rbfrMCWjt8gFv3zOEBjm+nqIx6S0M+wA9eH0heaHib8+2gzfteWmBwsYG5S8PoU8 5aNw== X-Gm-Message-State: AOAM532kUCl6suYSQvO4wvU91xfzqL+JmEGoR0WHg44xzo8fKNOKVCpH QyvixBgsSj+waL/4eSnyPTSFhg== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210310_071859_923491_6B55E6E8 X-CRM114-Status: GOOD ( 14.23 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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