There are currently three 'nr_hugepages' used to export the number of huge pages: 1. /proc/sys/vm/nr_hugepages 2. /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages 3. /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages For consistency, all three 'nr_hugepages' should return the total number of huge pages. When written, the number of persistent huge pages will be adjusted to the specified value. But, /proc/sys/vm/nr_hugepages returns the number of persistent huge pages. Signed-off-by: Xueshi Hu <xueshi.hu@xxxxxxxxxx> --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index e327a5a7602c..76af189053f0 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4606,7 +4606,7 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy, void *buffer, size_t *length, loff_t *ppos) { struct hstate *h = &default_hstate; - unsigned long tmp = h->max_huge_pages; + unsigned long tmp = h->nr_huge_pages; int ret; if (!hugepages_supported()) -- 2.40.1