• Michal Hocko's avatar
    memcg, thp: do not invoke oom killer on thp charges · 2a70f6a7
    Michal Hocko authored
    A THP memcg charge can trigger the oom killer since 25160354 ("mm,
    thp: remove __GFP_NORETRY from khugepaged and madvised allocations").
    We have used an explicit __GFP_NORETRY previously which ruled the OOM
    killer automagically.
    
    Memcg charge path should be semantically compliant with the allocation
    path and that means that if we do not trigger the OOM killer for costly
    orders which should do the same in the memcg charge path as well.
    Otherwise we are forcing callers to distinguish the two and use
    different gfp masks which is both non-intuitive and bug prone.  As soon
    as we get a costly high order kmalloc user we even do not have any means
    to tell the memcg specific gfp mask to prevent from OOM because the
    charging is deep within guts of the slab allocator.
    
    The unexpected memcg OOM on THP has already been fixed upstream by
    9d3c3354 ("mm, thp: do not cause memcg oom for thp") but this is a
    one-off fix rather than a generic solution.  Teach mem_cg...
    2a70f6a7
memcontrol.c 157 KB