Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: hugetlb_vmemmap: introduce the name HVO

It it inconvenient to mention the feature of optimizing vmemmap pages
associated with HugeTLB pages when communicating with others since there
is no specific or abbreviated name for it when it is first introduced.
Let us give it a name HVO (HugeTLB Vmemmap Optimization) from now.

This commit also updates the document about "hugetlb_free_vmemmap" by the
way discussed in thread [1].

Link: https://lore.kernel.org/all/21aae898-d54d-cc4b-a11f-1bb7fddcfffa@redhat.com/ [1]
Link: https://lkml.kernel.org/r/20220628092235.91270-4-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Will Deacon <will@kernel.org>
Cc: Xiongchun Duan <duanxiongchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Muchun Song and committed by
Andrew Morton
dff03381 cf5472e5

+23 -24
+4 -3
Documentation/admin-guide/kernel-parameters.txt
··· 1731 1731 hugetlb_free_vmemmap= 1732 1732 [KNL] Reguires CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP 1733 1733 enabled. 1734 + Control if HugeTLB Vmemmap Optimization (HVO) is enabled. 1734 1735 Allows heavy hugetlb users to free up some more 1735 1736 memory (7 * PAGE_SIZE for each 2MB hugetlb page). 1736 - Format: { [oO][Nn]/Y/y/1 | [oO][Ff]/N/n/0 (default) } 1737 + Format: { on | off (default) } 1737 1738 1738 - [oO][Nn]/Y/y/1: enable the feature 1739 - [oO][Ff]/N/n/0: disable the feature 1739 + on: enable HVO 1740 + off: disable HVO 1740 1741 1741 1742 Built with CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON=y, 1742 1743 the default is on.
+2 -2
Documentation/admin-guide/mm/hugetlbpage.rst
··· 164 164 will all result in 256 2M huge pages being allocated. Valid default 165 165 huge page size is architecture dependent. 166 166 hugetlb_free_vmemmap 167 - When CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP is set, this enables optimizing 168 - unused vmemmap pages associated with each HugeTLB page. 167 + When CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP is set, this enables HugeTLB 168 + Vmemmap Optimization (HVO). 169 169 170 170 When multiple huge page sizes are supported, ``/proc/sys/vm/nr_hugepages`` 171 171 indicates the current number of pre-allocated huge pages of the default size.
+2 -2
Documentation/admin-guide/mm/memory-hotplug.rst
··· 653 653 - Concurrent activity that operates on the same physical memory area, such as 654 654 allocating gigantic pages, can result in temporary offlining failures. 655 655 656 - - Out of memory when dissolving huge pages, especially when freeing unused 657 - vmemmap pages associated with each hugetlb page is enabled. 656 + - Out of memory when dissolving huge pages, especially when HugeTLB Vmemmap 657 + Optimization (HVO) is enabled. 658 658 659 659 Offlining code may be able to migrate huge page contents, but may not be able 660 660 to dissolve the source huge page because it fails allocating (unmovable) pages
+1 -2
Documentation/admin-guide/sysctl/vm.rst
··· 569 569 in include/linux/mm_types.h) is not power of two (an unusual system config could 570 570 result in this). 571 571 572 - Enable (set to 1) or disable (set to 0) the feature of optimizing vmemmap pages 573 - associated with each HugeTLB page. 572 + Enable (set to 1) or disable (set to 0) HugeTLB Vmemmap Optimization (HVO). 574 573 575 574 Once enabled, the vmemmap pages of subsequent allocation of HugeTLB pages from 576 575 buddy allocator will be optimized (7 pages per 2MB HugeTLB page and 4095 pages
+2
Documentation/mm/vmemmap_dedup.rst
··· 7 7 HugeTLB 8 8 ======= 9 9 10 + This section is to explain how HugeTLB Vmemmap Optimization (HVO) works. 11 + 10 12 The struct page structures (page structs) are used to describe a physical 11 13 page frame. By default, there is a one-to-one mapping from a page frame to 12 14 it's corresponding page struct.
+5 -7
fs/Kconfig
··· 247 247 248 248 # 249 249 # Select this config option from the architecture Kconfig, if it is preferred 250 - # to enable the feature of minimizing overhead of struct page associated with 251 - # each HugeTLB page. 250 + # to enable the feature of HugeTLB Vmemmap Optimization (HVO). 252 251 # 253 252 config ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP 254 253 bool ··· 258 259 depends on SPARSEMEM_VMEMMAP 259 260 260 261 config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON 261 - bool "Default optimizing vmemmap pages of HugeTLB to on" 262 + bool "HugeTLB Vmemmap Optimization (HVO) defaults to on" 262 263 default n 263 264 depends on HUGETLB_PAGE_OPTIMIZE_VMEMMAP 264 265 help 265 - When using HUGETLB_PAGE_OPTIMIZE_VMEMMAP, the optimizing unused vmemmap 266 - pages associated with each HugeTLB page is default off. Say Y here 267 - to enable optimizing vmemmap pages of HugeTLB by default. It can then 268 - be disabled on the command line via hugetlb_free_vmemmap=off. 266 + The HugeTLB VmemmapvOptimization (HVO) defaults to off. Say Y here to 267 + enable HVO by default. It can be disabled via hugetlb_free_vmemmap=off 268 + (boot command line) or hugetlb_optimize_vmemmap (sysctl). 269 269 270 270 config MEMFD_CREATE 271 271 def_bool TMPFS || HUGETLBFS
+1 -2
include/linux/page-flags.h
··· 208 208 DECLARE_STATIC_KEY_FALSE(hugetlb_optimize_vmemmap_key); 209 209 210 210 /* 211 - * If the feature of optimizing vmemmap pages associated with each HugeTLB 212 - * page is enabled, the head vmemmap page frame is reused and all of the tail 211 + * If HVO is enabled, the head vmemmap page frame is reused and all of the tail 213 212 * vmemmap addresses map to the head vmemmap page frame (furture details can 214 213 * refer to the figure at the head of the mm/hugetlb_vmemmap.c). In other 215 214 * words, there are more than one page struct with PG_head associated with each
+4 -4
mm/hugetlb_vmemmap.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * Optimize vmemmap pages associated with HugeTLB 3 + * HugeTLB Vmemmap Optimization (HVO) 4 4 * 5 - * Copyright (c) 2020, Bytedance. All rights reserved. 5 + * Copyright (c) 2020, ByteDance. All rights reserved. 6 6 * 7 7 * Author: Muchun Song <songmuchun@bytedance.com> 8 8 * ··· 156 156 157 157 /* 158 158 * There are only (RESERVE_VMEMMAP_SIZE / sizeof(struct page)) struct 159 - * page structs that can be used when CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP, 160 - * so add a BUILD_BUG_ON to catch invalid usage of the tail struct page. 159 + * page structs that can be used when HVO is enabled, add a BUILD_BUG_ON 160 + * to catch invalid usage of the tail page structs. 161 161 */ 162 162 BUILD_BUG_ON(__NR_USED_SUBPAGE >= 163 163 RESERVE_VMEMMAP_SIZE / sizeof(struct page));
+2 -2
mm/hugetlb_vmemmap.h
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * Optimize vmemmap pages associated with HugeTLB 3 + * HugeTLB Vmemmap Optimization (HVO) 4 4 * 5 - * Copyright (c) 2020, Bytedance. All rights reserved. 5 + * Copyright (c) 2020, ByteDance. All rights reserved. 6 6 * 7 7 * Author: Muchun Song <songmuchun@bytedance.com> 8 8 */