lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 3 Apr 2018 14:11:57 -0400
From:   Johannes Weiner <hannes@...xchg.org>
To:     Michal Hocko <mhocko@...nel.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        David Rientjes <rientjes@...gle.com>,
        "Kirill A. Shutemov" <kirill@...temov.name>,
        Vlastimil Babka <vbabka@...e.cz>, linux-mm@...ck.org,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] memcg, thp: do not invoke oom killer on thp charges

On Tue, Apr 03, 2018 at 05:55:09PM +0200, Michal Hocko wrote:
> On Tue 03-04-18 10:58:53, Johannes Weiner wrote:
> > On Wed, Mar 21, 2018 at 09:59:28PM +0100, Michal Hocko wrote:
> > > From: Michal Hocko <mhocko@...e.com>
> > > 
> > > David has noticed that THP memcg charge can trigger the oom killer
> > > since 2516035499b9 ("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. Not to
> > > mention the maintenance burden.
> > > 
> > > Teach mem_cgroup_oom to bail out on costly order requests to fix the THP
> > > issue as well as any other costly OOM eligible allocations to be added
> > > in future.
> > > 
> > > Fixes: 2516035499b9 ("mm, thp: remove __GFP_NORETRY from khugepaged and madvised allocations")
> > > Reported-by: David Rientjes <rientjes@...gle.com>
> > > Signed-off-by: Michal Hocko <mhocko@...e.com>
> > 
> > I also prefer this fix over having separate OOM behaviors (which is
> > user-visible, and not just about technical ability to satisfy the
> > allocation) between the allocator and memcg.
> > 
> > Acked-by: Johannes Weiner <hannes@...xchg.org>
> 
> I will repost the patch with the currently merged THP specific handling
> reverted (see below). While 9d3c3354bb85 might have been an appropriate
> quick fix, we shouldn't keep it longterm for 4.17+ IMHO.
> 
> Does you ack apply to that patch as well?

Yep, looks good to me.

> From: Michal Hocko <mhocko@...e.com>
> Date: Wed, 21 Mar 2018 10:10:37 +0100
> Subject: [PATCH] memcg, thp: do not invoke oom killer on thp charges
> 
> David has noticed that THP memcg charge can trigger the oom killer
> since 2516035499b9 ("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
> 9d3c3354bb85 ("mm, thp: do not cause memcg oom for thp") but this is
> one-off fix rather than a generic solution. Teach mem_cgroup_oom to bail
> out on costly order requests to fix the THP issue as well as any other
> costly OOM eligible allocations to be added in future.
> 
> Also revert 9d3c3354bb85 because special gfp for THP is no longer
> needed.
> 
> Fixes: 2516035499b9 ("mm, thp: remove __GFP_NORETRY from khugepaged and madvised allocations")
> Reported-by: David Rientjes <rientjes@...gle.com>
> Signed-off-by: Michal Hocko <mhocko@...e.com>

Acked-by: Johannes Weiner <hannes@...xchg.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ