• W
    mm/sharepool: Clear the initialization of sp-associated structure for a process · 17b95816
    Wang Wensheng 提交于
    hulk inclusion
    category: feature
    bugzilla: https://gitee.com/openeuler/kernel/issues/I5EORS
    CVE: NA
    
    --------------------------------
    
    A few structures must have been created when a process want to get into
    sharepool subsystem, including allocating sharepool memory, being added
    into a spg or doing k2u and so on.
    
    Currently we create those structures just before we actually need them.
    For example, we find or create a sp_spa_stat after a successful memory
    allocation and before updating the statistical structure. The creation of
    a new structure may fail due to oom and we should then reclaim the
    memory allocated and revert all the process before. Or we just forget to
    do that and a potential memory-leak occurs. This design makes it
    confused when we indeed create a structure and we always worry about
    potential memory-leak when we changes the code around it.
    
    A better solution is to initialize all that structures at the same time
    when a process join in sharepool subsystem. And in future, we will clear
    the unnecessary statistical structures.
    Signed-off-by: NWang Wensheng <wangwensheng4@huawei.com>
    Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
    Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
    17b95816
share_pool.c 117.4 KB