• Vladimir Davydov's avatar
    memcg: do not allow to disable tcp accounting after limit is set · 9ee11ba4
    Vladimir Davydov authored
    There are two bits defined for cg_proto->flags - MEMCG_SOCK_ACTIVATED
    and MEMCG_SOCK_ACTIVE - both are set in tcp_update_limit, but the former
    is never cleared while the latter can be cleared by unsetting the limit.
    This allows to disable tcp socket accounting for new sockets after it
    was enabled by writing -1 to memory.kmem.tcp.limit_in_bytes while still
    guaranteeing that memcg_socket_limit_enabled static key will be
    decremented on memcg destruction.
    
    This functionality looks dubious, because it is not clear what a use
    case would be.  By enabling tcp accounting a user accepts the price.  If
    they then find the performance degradation unacceptable, they can always
    restart their workload with tcp accounting disabled.  It does not seem
    there is any need to flip it while the workload is running.
    
    Besides, it contradicts to how kmem accounting API works: writing
    whatever to memory.kmem.limit_in_bytes enables kmem accounting for the
    cgroup in ques...
    9ee11ba4
memcontrol.c 146 KB