From patchwork Tue May 18 09:18:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12264315 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.1 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,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 16469C433ED for ; Tue, 18 May 2021 09:23:38 +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 8E16561285 for ; Tue, 18 May 2021 09:23:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E16561285 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: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:In-Reply-To:References:List-Owner; bh=nmBULBLRgufg3xevj15TqHiJQ9GZwLEiD2DcIx/s7ws=; b=PmY1fiWg4wioUkVoPZu8Ws+MIg u+Sv2i7jmh5ioacY97elOypGpeOZIW6jV2qijD+nlmy3U2qgWh6sQLneJhIDDnNd9owjBsqZQU8t8 boQViRLyJePoSNhVmRTemU8dYFhTkER0VO+gQAXKrUx/YduGc0DFgBY56DawUqhCmiR+5+EYkSeoM 214+FN44mR2CAqmw8OrGRPZhvEFCSqH3KdsB9fOVsw5RbXU+qN7VcaMBpr6MM+qxiH3lZRbBE0SNZ LlQYNZBWUXvu75Jf2s+HEFbCIh0j2pPsHVCkQdfQgeb7RcQy+wZp9iVrraJHRCjezXYjPx7lV4yiA wE3czUzQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1livv2-0006y5-Ik; Tue, 18 May 2021 09:21:42 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1livv0-0006xS-AI for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 09:21:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=av1Oh98AjSqD3EqUtlRs5SqXwoUpF6yWirgoJQzOgDs=; b=VH4qF1JjV7RC9f8GR8sAp+9ers 1ZzsrN2zPiYb64GX8dmqJPVXX2kr3kOHMae4CH7jUzSLyd8zmd9jFTy6CaxUFbEJVidT71WTQ+d6o v2sZWeHYSa3H2eXaCaHV4AKHWlPijSGB3mzDb2OhCUrTEO5jX+hZR1QulazivKrNJtZTjpuB+oqZF T5/ZeYfOESRAvxoQTadSs5nS9RVc2LngmXBCKwYv22QZ8XZHpnTMN+34aAgim//ZMu1uDMgJ5QAVa xzRPV5wDsx0/ZsZtxAXR0gL+/xE4hXemixW9SCWcI6STnZLrYWu/u337HakXWH0arAVixfroeNJB4 j436V9BA==; Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1livux-00EVFC-2m for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 09:21:36 +0000 Received: by mail-pj1-x102a.google.com with SMTP id gb21-20020a17090b0615b029015d1a863a91so1203967pjb.2 for ; Tue, 18 May 2021 02:21:32 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=av1Oh98AjSqD3EqUtlRs5SqXwoUpF6yWirgoJQzOgDs=; b=1L3udiYJUhcuPlReJBTEnyZTAVVvIIjaSUD5Pfa87FqrpZodOYwUtjD/PCKtLAH7vu oWs5mvMA5upa5qr6kG0RInr45E5xuirNQYuEuhngZvhtePmVp09JfDCE4v0WtVKuRerJ lE0Wpap9ZUcWFb/SVDqpR2FfXWJgAvCLJFLyNQn+LcMHRVkyweET4N+5LuwRGSxVE+Lm JtOodVnyWaLPKM30PsbTEBKgN6VYEIeT3RE6gjZud1FWSyprI+Kp+CTI2k7H/DnOCIzV CWaUZCffH5XTHtFzEngLp6YueyZzaJTMx67cfs4EYAttGczQDWPkkpcXa0yN4XNojV4h y+yg== 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:mime-version :content-transfer-encoding; bh=av1Oh98AjSqD3EqUtlRs5SqXwoUpF6yWirgoJQzOgDs=; b=t4lxshtkN3Fj6FjBq8VfE2FErcE92t+WpKeyj3tmNrvE/ZPpf+qDp/FPjJlkIn/ZTH PU5R75pH9O/epAXAdQlQ1XUJMOGKhHf4FHuuoCxueyb0NKR16DzpVwzjrHpuHp5bcu9A ayn6cCE1gJOnEhI0ZXu0AbNxSj48gm1aSA+DjN2Eyqt403axfhl10cJm16ghITOBCBDN 1Gud8auXqLCQS8iyCtFlLLGr8zD4OU+Gq6xAbb7XgzLMQb2j/Lo4KMGL/sKp1YG+7IEM SuPg9aIBysWjmaE3lwaJimaaGUqk1KVD/HImA+7jSxqJkSdBzWmWWYDSFCASkKW3ttCO 6yxg== X-Gm-Message-State: AOAM533lJovZIbTAyMCxgnMwVbePeCZYzM721VQUBcNBXVZaGZDwZYlb kzgRGpPXTVZWWwvdhWuUXxk/nw== X-Google-Smtp-Source: ABdhPJzDPmbgt9y+IQNNyRtJP0Pqx2akeskwHAD/9soF2DwjZGGkLEEVWUw42Zn8i46hVz4YpN+TVg== X-Received: by 2002:a17:902:e309:b029:f1:9342:2036 with SMTP id q9-20020a170902e309b02900f193422036mr3573888plc.53.1621329691556; Tue, 18 May 2021 02:21:31 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id p11sm12025262pgn.65.2021.05.18.02.21.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 May 2021 02:21:30 -0700 (PDT) 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, fam.zheng@bytedance.com, zhengqi.arch@bytedance.com, Muchun Song Subject: [PATCH] arm64: mm: hugetlb: add support for free vmemmap pages of HugeTLB Date: Tue, 18 May 2021 17:18:26 +0800 Message-Id: <20210518091826.36937-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_022135_131677_DA55FE8B X-CRM114-Status: GOOD ( 14.58 ) 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 HugeTLB page is ready, so we can support this feature for arm64. Signed-off-by: Muchun Song --- arch/arm64/mm/mmu.c | 5 +++++ fs/Kconfig | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 5d37e461c41f..967b01ce468d 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -1134,6 +1135,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 6ce6fdac00a3..02c2d3bf1cb8 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -242,7 +242,7 @@ config HUGETLB_PAGE config HUGETLB_PAGE_FREE_VMEMMAP def_bool HUGETLB_PAGE - depends on X86_64 + depends on X86_64 || ARM64 depends on SPARSEMEM_VMEMMAP config MEMFD_CREATE