• R
    mm: kmem: move memcg_kmem_bypass() calls to get_mem/obj_cgroup_from_current() · 279c3393
    Roman Gushchin 提交于
    Patch series "mm: kmem: kernel memory accounting in an interrupt context".
    
    This patchset implements memcg-based memory accounting of allocations made
    from an interrupt context.
    
    Historically, such allocations were passed unaccounted mostly because
    charging the memory cgroup of the current process wasn't an option.  Also
    performance reasons were likely a reason too.
    
    The remote charging API allows to temporarily overwrite the currently
    active memory cgroup, so that all memory allocations are accounted towards
    some specified memory cgroup instead of the memory cgroup of the current
    process.
    
    This patchset extends the remote charging API so that it can be used from
    an interrupt context.  Then it removes the fence that prevented the
    accounting of allocations made from an interrupt context.  It also
    contains a couple of optimizations/code refactorings.
    
    This patchset doesn't directly enable accounting for any specific
    allocations, but prepares the code base for it.  The bpf memory accounting
    will likely be the first user of it: a typical example is a bpf program
    parsing an incoming network packet, which allocates an entry in hashmap
    map to store some information.
    
    This patch (of 4):
    
    Currently memcg_kmem_bypass() is called before obtaining the current
    memory/obj cgroup using get_mem/obj_cgroup_from_current().  Moving
    memcg_kmem_bypass() into get_mem/obj_cgroup_from_current() reduces the
    number of call sites and allows further code simplifications.
    Signed-off-by: NRoman Gushchin <guro@fb.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Reviewed-by: NShakeel Butt <shakeelb@google.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Michal Hocko <mhocko@kernel.org>
    Link: http://lkml.kernel.org/r/20200827225843.1270629-1-guro@fb.com
    Link: http://lkml.kernel.org/r/20200827225843.1270629-2-guro@fb.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    279c3393
memcontrol.c 190.8 KB