From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796160412; b=PaSeUFQ4qbp0Ig8je3shVeNN9FM6vDPSh2FYnd3TgQGcNN0u5dDIEeoCw/j8doJU8Wl0 SE1YxfC86NA7/+9B/5YdahZXDm60bzJKa9HVwi0UPLcolH8qEMYlfq+JAjllWNt4YycJY rjTwk2unlCo2hjHX+QEg+XwYh2hnU3rR8fK5YUp/Zg1B2qLRfeE/UjkbHnaV+E/4usCAX eOzq34Yk38TKUaiYw+0ew2XgumfUqy3W5UOLnHhYkmoA1ek77A6JYSvSftKuI7ayWi/oy RNWoNIs9cN2RMdp62b70YtqOyvijAMKdE3s+c80sAt2wakPjF6LS6q/Wi4zvDNWYfMQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796160412; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=J+U3k8ItBim0zv5MKen0kaCX0rOcMrlqw7QIHJrMG5g=; b=hwxtv5sz+8aw8j5gx0cj1vv0OJL+nzUlJJTkcyVTwFCFe08r0eJJQPtk3tpdE/OHCubu Elui8aIcciIPboBfY6Qh1bO+rbv2/mOATIGcvTv9ct9iZRKICIHxzCOFaFBylwwb0EwH4 xAGBhPkPCaCsjgSgji5FXDuei3rebCiMZdFPzN/8SMAx34Pjxa5HLAKo9QkjSAaevsVZ0 e9MHFrNqGaKVRARHL29+w/djrf6sFIUIcop0HDBV4zTPD/VRLN3PWC1CtIT4p7r561g9e BNnRU6J8M5V+ZbiokglRxEoOf8cFN/8WwfbAWULGnvo6qV8b8MYWUI9hrFrh+HQKcEA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=rd5pS8lQ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED933606A31A for ; Tue, 1 Dec 2026 21:26:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=rd5pS8lQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 935E41F00897; Tue, 1 Dec 2026 21:26:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796160411; bh=J+U3k8ItBim0zv5MKen0kaCX0rOcMrlqw7QIHJrMG5g=; h=Date:To:From:In-Reply-To:References:Subject; b=rd5pS8lQJW99U+xTg7enGROqe9BTvGrB2R8hONHrmnaqq90ydvzgGivy0bj90FVIl FH+Y+FxPes+zXd9VKE5oioZbOgaFnHhlfX2Ej3ybEaoL+gmTPiUcCK4MG/17pUi46T bSVjXe40RSw9OelgxInFRcbHZgCfdSIwEdtbWP9o= Date: Tue, 01 Dec 2026 13:26:51 -0800 To: mm-commits@vger.kernel.org,rppt@kernel.org,qi.zheng@linux.dev, osalvador@suse.de,nobody@kernel.org,lance.yang@linux.dev,david@kernel.org, songmuchun@bytedance.com,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261201095840.3034368-2-songmuchun@bytedance.com> References: <20261201095840.3034368-2-songmuchun@bytedance.com> Subject: + mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch added to mm-new branch Message-Id: <20261201212651.935E41F00897@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/hugetlb_vmemmap: remove the vmemmap savings boot message has been added to the -mm mm-new branch. Its filename is mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Muchun Song Subject: mm/hugetlb_vmemmap: remove the vmemmap savings boot message Date: Tue, 01 Dec 2026 17:58:35 +0800 Patch series "mm: Simplify HugeTLB vmemmap optimization code", v2. HugeTLB vmemmap optimization has evolved over time, leaving obsolete and duplicated logic spread across the implementation. This makes the code harder to follow and obscures the contract shared by HugeTLB and the generic vmemmap optimization helpers. Simplify the code around that common contract and align the HVO implementation with its current behavior. The first five patches simplify the HugeTLB-specific implementation. The final patch centralizes the support condition shared by HVO and the generic compound-page helpers. This patch (of 6): The boot message reports the potential vmemmap savings for each HugeTLB page size. It is a static estimate and does not indicate whether HVO is enabled or how much vmemmap memory is actually in use. Users can query vm.hugetlb_optimize_vmemmap for the HVO enable policy and inspect nr_memmap_pages and nr_memmap_boot_pages in /proc/vmstat for the actual vmemmap usage. Remove the boot message and hugetlb_vmemmap_optimizable_size(), which is only used to calculate the reported estimate. Link: https://lore.kernel.org/20261201095840.3034368-1-songmuchun@bytedance.com Link: https://patch.msgid.link/20261201095840.3034368-2-songmuchun@bytedance.com Signed-off-by: Muchun Song Signed-off-by: Andrew Morton Reviewed-by: Lance Yang Cc: Oscar Salvador Cc: Mike Rapoport Cc: David Hildenbrand Cc: Qi Zheng Cc: nobody include/linux/hugetlb.h | 4 ++-- mm/hugetlb.c | 2 -- mm/hugetlb_vmemmap.h | 27 ++++----------------------- 3 files changed, 6 insertions(+), 27 deletions(-) --- a/include/linux/hugetlb.h~mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message +++ a/include/linux/hugetlb.h @@ -814,7 +814,7 @@ static inline unsigned long huge_page_ma return h->mask; } -static inline unsigned int huge_page_order(struct hstate *h) +static inline unsigned int huge_page_order(const struct hstate *h) { return h->order; } @@ -1233,7 +1233,7 @@ static inline unsigned long huge_page_ma return PAGE_MASK; } -static inline unsigned int huge_page_order(struct hstate *h) +static inline unsigned int huge_page_order(const struct hstate *h) { return 0; } --- a/mm/hugetlb.c~mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message +++ a/mm/hugetlb.c @@ -3759,8 +3759,6 @@ static void __init report_hugepages(void string_get_size(huge_page_size(h), 1, STRING_UNITS_2, buf, sizeof(buf)); pr_info("registered %s page size, pre-allocated %ld pages\n", buf, h->nr_huge_pages); - pr_info("%d KiB vmemmap can be freed for a %s page\n", - hugetlb_vmemmap_optimizable_size(h) / SZ_1K, buf); } } --- a/mm/hugetlb_vmemmap.h~mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message +++ a/mm/hugetlb_vmemmap.h @@ -33,23 +33,6 @@ static inline void hugetlb_vmemmap_write up_write(&vmemmap_remap_rwsem); } -static inline unsigned int hugetlb_vmemmap_size(const struct hstate *h) -{ - return pages_per_huge_page(h) * sizeof(struct page); -} - -/* - * Return how many vmemmap size associated with a HugeTLB page that can be - * optimized and can be freed to the buddy allocator. - */ -static inline unsigned int hugetlb_vmemmap_optimizable_size(const struct hstate *h) -{ - int size = hugetlb_vmemmap_size(h) - VMEMMAP_OPTIMIZATION_SIZE; - - if (!is_power_of_2(sizeof(struct page))) - return 0; - return size > 0 ? size : 0; -} #else static inline int hugetlb_vmemmap_restore_folio(const struct hstate *h, struct folio *folio) { @@ -80,11 +63,6 @@ static inline void hugetlb_vmemmap_write { } -static inline unsigned int hugetlb_vmemmap_optimizable_size(const struct hstate *h) -{ - return 0; -} - static inline void hugetlb_vmemmap_optimize_bootmem_page(unsigned long pfn, unsigned int order) { } @@ -95,6 +73,9 @@ DEFINE_LOCK_GUARD_0(vmemmap_remap, static inline bool hugetlb_vmemmap_optimizable(const struct hstate *h) { - return hugetlb_vmemmap_optimizable_size(h) != 0; + if (!IS_ENABLED(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP)) + return false; + + return vmemmap_optimizable_order(huge_page_order(h)); } #endif /* _LINUX_HUGETLB_VMEMMAP_H */ _ Patches currently in -mm which might be from songmuchun@bytedance.com are powerpc-mm-make-vmemmap_populate_compound_pages-static.patch powerpc-mm-drop-powerpc-vmemmap_can_optimize.patch mm-sparse-vmemmap-drop-vmemmap_can_optimize.patch mm-sparse-vmemmap-drop-pgmap-from-vmemmap-population-apis.patch mm-hugetlb_vmemmap-fix-hwpoison-state-races-during-optimization.patch mm-hugetlb_vmemmap-fix-pmd-split-tlb-flush-race.patch mm-hugetlb_vmemmap-fix-deadlock-during-pmd-split.patch mm-list_lru-fix-potential-infinite-loop-on-xa-node-allocation-failure.patch mm-mm_init-verify-zones-for-template-initialized-pages.patch mm-mm_init-factor-out-common-struct-page-initialization.patch mm-mm_init-simplify-zone-device-page-initialization.patch mm-mm_init-factor-out-compound-page-initialization.patch mm-hugetlb-drop-boot-time-hvo-handling-for-gigantic-folios.patch mm-hugetlb-initialize-all-struct-pages-for-bootmem-hugepages.patch mm-hugetlb-use-common-compound-page-initialization-helper.patch mm-mm_init-make-__init_single_page-static.patch mm-cma-centralize-cma-pageblock-initialization.patch mm-cma-localize-init_cma_pageblock-to-cmac.patch mm-mm_init-move-pageblock-migratetype-init-to-memmap-helpers.patch kmsan-encapsulate-per-page-metadata-access.patch mm-page_ext-fix-client-data-alignment.patch mm-page_ext-always-use-vmalloc-for-section-page-extensions.patch mm-page_ext-use-common-allocation-and-initialization-entry-points.patch mm-page_ext-allocate-page-extensions-early-for-sparsemem.patch mm-page_ext-inline-unchecked-page-extension-lookup.patch kmsan-fix-metadata-loss-during-hugetlb-struct-page-reinitialization.patch mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers.patch mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument.patch mm-hugetlb_vmemmap-open-code-free_vmemmap_page.patch mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning.patch mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check.patch