• L
    mm/dynamic_hugetlb: establish the dynamic hugetlb feature framework · a8a836a3
    Liu Shixin 提交于
    hulk inclusion
    category: feature
    bugzilla: 46904, https://gitee.com/openeuler/kernel/issues/I4QSHG
    CVE: NA
    
    --------------------------------
    
    Dynamic hugetlb is a self-developed feature based on the hugetlb and memcontrol.
    It supports to split huge page dynamically in a memory cgroup. There is a new structure
    dhugetlb_pool in every mem_cgroup to manage the pages configured to the mem_cgroup.
    For the mem_cgroup configured with dhugetlb_pool, processes in the mem_cgroup will
    preferentially use the pages in dhugetlb_pool.
    
    Dynamic hugetlb supports three types of pages, including 1G/2M huge pages and 4K pages.
    For the mem_cgroup configured with dhugetlb_pool, processes will be limited to alloc
    1G/2M huge pages only from dhugetlb_pool. But there is no such constraint for 4K pages.
    If there are insufficient 4K pages in the dhugetlb_pool, pages can also be allocated from
    buddy system. So before using dynamic hugetlb, user must know how many huge pages they
    need.
    
    Usage:
    1. Add 'dynamic_hugetlb=on' in cmdline to enable dynamic hugetlb feature.
    2. Prealloc some 1G hugepages through hugetlb.
    3. Create a mem_cgroup and configure dhugetlb_pool to mem_cgroup.
    4. Configure the count of 1G/2M hugepages, and the remaining pages in dhugetlb_pool will
       be used as basic pages.
    5. Bound a process to mem_cgroup. then the memory for it will be allocated from dhugetlb_pool.
    
    This patch add the corresponding structure dhugetlb_pool for dynamic hugetlb feature,
    the interface 'dhugetlb.nr_pages' in mem_cgroup to configure dhugetlb_pool and the cmdline
    'dynamic_hugetlb=on' to enable dynamic hugetlb feature.
    Signed-off-by: NLiu Shixin <liushixin2@huawei.com>
    Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
    Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
    a8a836a3
dynamic_hugetlb.c 9.4 KB