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