]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: selftests: Add a helper to get system default hugetlb page size
authorYanan Wang <wangyanan55@huawei.com>
Tue, 30 Mar 2021 08:08:53 +0000 (16:08 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 20 Apr 2021 08:18:52 +0000 (04:18 -0400)
commite633f1adf28a0115d86e0a46880eb37b1841d3a9
tree46657689fe808f51cec2fcc9caab777c0eb7f5c0
parentfff2474dd786cbfbcdd5e659e0d74f8bd4527902
KVM: selftests: Add a helper to get system default hugetlb page size

If HUGETLB is configured in the host kernel, then we can know the system
default hugetlb page size through *cat /proc/meminfo*. Otherwise, we will
not see the information of hugetlb pages in file /proc/meminfo if it's not
configured. So add a helper to determine whether HUGETLB is configured and
then get the default page size by reading /proc/meminfo.

This helper can be useful when a program wants to use the default hugetlb
pages of the system and doesn't know the default page size.

Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Message-Id: <20210330080856.14940-8-wangyanan55@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/include/test_util.h
tools/testing/selftests/kvm/lib/test_util.c