[Devel] [PATCH vz9 13/16] mm: default collapse huge pages if there's at least 1/4th ptes mapped

Nikita Yushchenko nikita.yushchenko at virtuozzo.com
Wed Sep 29 10:00:14 MSK 2021


From: Vladimir Davydov <vdavydov at virtuozzo.com>

A huge page may be collapsed by khugepaged if there's not more than
khugepaged_max_ptes_none unmapped ptes (configured via sysfs). The
latter equals 511 (HPAGE_PMD_NR - 1) by default, which results in
noticeable growth in memory footprint if a process has a sparse address
space. Experiments have shown (see bug-id below) that decreasing the
threshold down to 384 (3/4*HPAGE_PMD_NR) results in no performance
degradation for VMs and CTs and at the same time improves test results
for VMs (because qemu has a sparse heap). So let's set it by default.

https://jira.sw.ru/browse/PSBM-48885

Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>

(cherry-picked from vz8 commit 5878a943f42e ("mm: default collapse huge
pages if there's at least 1/4th ptes mapped"))

Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 mm/khugepaged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index b0412be08fa2..f0f290dbcd02 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -392,7 +392,7 @@ int __init khugepaged_init(void)
 		return -ENOMEM;
 
 	khugepaged_pages_to_scan = HPAGE_PMD_NR * 8;
-	khugepaged_max_ptes_none = HPAGE_PMD_NR - 1;
+	khugepaged_max_ptes_none = HPAGE_PMD_NR*3/4;
 	khugepaged_max_ptes_swap = HPAGE_PMD_NR / 8;
 	khugepaged_max_ptes_shared = HPAGE_PMD_NR / 2;
 
-- 
2.30.2



More information about the Devel mailing list