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

Konstantin Khorenko khorenko at virtuozzo.com
Thu Sep 30 17:44:06 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit 841383a48bfdbbe73b955c00bad03eb6d2082cd6
Author: Vladimir Davydov <vdavydov.dev at gmail.com>
Date:   Thu Sep 30 17:44:05 2021 +0300

    mm: default collapse huge pages if there's at least 1/4th ptes mapped
    
    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;
 


More information about the Devel mailing list