Re: [PATCH v18 6/9] mm: hugetlb: add a kernel parameter hugetlb_free_vmemmap

From: Randy Dunlap
Date: Wed Mar 10 2021 - 12:18:04 EST


On 3/10/21 7:37 AM, Michal Hocko wrote:
> On Mon 08-03-21 18:28:04, Muchun Song wrote:
>> Add a kernel parameter hugetlb_free_vmemmap to enable the feature of
>> freeing unused vmemmap pages associated with each hugetlb page on boot.
>>
>> We disables PMD mapping of vmemmap pages for x86-64 arch when this
>> feature is enabled. Because vmemmap_remap_free() depends on vmemmap
>> being base page mapped.
>>
>> Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
>> Reviewed-by: Oscar Salvador <osalvador@xxxxxxx>
>> Reviewed-by: Barry Song <song.bao.hua@xxxxxxxxxxxxx>
>> Reviewed-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
>> Tested-by: Chen Huang <chenhuang5@xxxxxxxxxx>
>> Tested-by: Bodeddula Balasubramaniam <bodeddub@xxxxxxxxxx>
>> ---
>> Documentation/admin-guide/kernel-parameters.txt | 14 ++++++++++++++
>> Documentation/admin-guide/mm/hugetlbpage.rst | 3 +++
>> arch/x86/mm/init_64.c | 8 ++++++--
>> include/linux/hugetlb.h | 19 +++++++++++++++++++
>> mm/hugetlb_vmemmap.c | 24 ++++++++++++++++++++++++
>> 5 files changed, 66 insertions(+), 2 deletions(-)
>>
>> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
>> index 04545725f187..de91d54573c4 100644
>> --- a/Documentation/admin-guide/kernel-parameters.txt
>> +++ b/Documentation/admin-guide/kernel-parameters.txt
>> @@ -1557,6 +1557,20 @@
>> Documentation/admin-guide/mm/hugetlbpage.rst.
>> Format: size[KMG]
>>
>> + hugetlb_free_vmemmap=
>> + [KNL] When CONFIG_HUGETLB_PAGE_FREE_VMEMMAP is set,
>> + this controls freeing unused vmemmap pages associated
>> + with each HugeTLB page. When this option is enabled,
>> + we disable PMD/huge page mapping of vmemmap pages which
>> + increase page table pages. So if a user/sysadmin only
>> + uses a small number of HugeTLB pages (as a percentage
>> + of system memory), they could end up using more memory
>> + with hugetlb_free_vmemmap on as opposed to off.
>> + Format: { on | off (default) }
>
> Please note this is an admin guide and for those this seems overly low
> level. I would use something like the following
> [KNL] Reguires CONFIG_HUGETLB_PAGE_FREE_VMEMMAP
> enabled.
> Allows heavy hugetlb users to free up some more
> memory (6 * PAGE_SIZE for each 2MB hugetlb
> page).
> This feauture is not free though. Large page
> tables are not use to back vmemmap pages which

are not used

> can lead to a performance degradation for some
> workloads. Also there will be memory allocation
> required when hugetlb pages are freed from the
> pool which can lead to corner cases under heavy
> memory pressure.
>> +
>> + on: enable the feature
>> + off: disable the feature
>> +
>> hung_task_panic=
>> [KNL] Should the hung task detector generate panics.
>> Format: 0 | 1


--
~Randy