• L
    mm/memcontrol: fix wrong vmstats for dying memcg · b2cd06f8
    Lu Jialin 提交于
    hulk inclusion
    category: bugfix
    bugzilla: https://gitee.com/openeuler/kernel/issues/I5E8LA
    CVE: NA
    
    --------------------------------
    
    At present, only when the absolute value of stat_cpu->count exceeds
    MEMCG_CHARGE_BATCH will it be updated to stat, so there will always
    be a certain lag difference between stat and the correct value.
    
    In addition, since the partially deleted memcg is still referenced, it
    will not be freed immediately after it is offline. Although the
    remaining memcg has released the page, it and the parent's stat will
    still be not 0 or too large due to the update lag, which leads to the
    abnormality of the total_<count> parameter in the memory.stat file.
    
    This patch mainly solves the problem of synchronization between
    memcg's stat and the correct value during the destruction process
    from two aspects:
    1) Perform a flush synchronization operation when memcg is offline
    2) For memcg in the process of being destroyed, bypass the threshold
       judgment when updating vmstats
    Signed-off-by: NLu Jialin <lujialin4@huawei.com>
    Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
    Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
    Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
    b2cd06f8
memcontrol.c 184.4 KB