• W
    share_pool: Compact memory when necessary · 9fbf9524
    Wang Wensheng 提交于
    ascend inclusion
    category: Feature
    bugzilla: https://gitee.com/openeuler/kernel/issues/I4NDAW
    CVE: NA
    
    -------------------
    
    When the memory is insufficient or fragmentation is severe,
    the 2MB hugepage allocation will perform direct reclaim and
    compact.
    
    The direct reclaim and compact may take a long time. As a
    result, sp mutex will be hold for too long time to casue
    the hung task problem. In this case, set the PF_MEMALLOC
    flag to prevent the direct reclaim and compact from being
    executed.
    
    Direct compact is not allowed during hugepage allocation.
    As a result, 2MB hugepage may failed to be applied for.
    
    When do sp alloc, if the 2MB hugepage cannot be allocated
    of the total free memory is less than 1/3 of total memory,
    a work is added compact the memory asynchronously.
    
    When do sp free, if the total free memory is less than 1/3
    of total memory, compact memory synchronously.
    
    We can disable this and change the compact frequence through sysctl.
    Signed-off-by: NZhou Guanghui <zhouguanghui1@huawei.com>
    Signed-off-by: NWang Wensheng <wangwensheng4@huawei.com>
    Reviewed-by: Kefeng Wang<wangkefeng.wang@huawei.com>
    Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
    Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
    9fbf9524
share_pool.c 54.5 KB