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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 24 Apr 2018 14:54:15 +0100
From:   Roman Gushchin <guro@...com>
To:     Vladimir Davydov <vdavydov.dev@...il.com>
CC:     <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
        <cgroups@...r.kernel.org>, <kernel-team@...com>,
        Johannes Weiner <hannes@...xchg.org>,
        Michal Hocko <mhocko@...e.com>, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH v2] mm: introduce memory.min

Hi Vladimir!

> On Mon, Apr 23, 2018 at 01:36:10PM +0100, Roman Gushchin wrote:
> > +  memory.min
> > +	A read-write single value file which exists on non-root
> > +	cgroups.  The default is "0".
> > +
> > +	Hard memory protection.  If the memory usage of a cgroup
> > +	is within its effective min boundary, the cgroup's memory
> > +	won't be reclaimed under any conditions. If there is no
> > +	unprotected reclaimable memory available, OOM killer
> > +	is invoked.
> 
> What will happen if all tasks attached to a cgroup are killed by OOM,
> but its memory usage is still within memory.min? Will memory.min be
> ignored then?

Not really.

I don't think it's a big problem as long as a user isn't doing
something weird (e.g. moving processes with significant
amount of charged memory to other cgroups).

But what we can do here, is to ignore memory.min of empty cgroups
(patch below), it will resolve some edge cases like this.

Thanks!

--------------------------------------------------------------------------------

>From 54a4f4fc9f8a6847c8a5814c53f0b575010808e5 Mon Sep 17 00:00:00 2001
From: Roman Gushchin <guro@...com>
Date: Tue, 24 Apr 2018 14:44:14 +0100
Subject: [PATCH] mm: ignore memory.min of abandoned memory cgroups

If a cgroup has no associated tasks, invoking the OOM killer
won't help release any memory, so respecting the memory.min
can lead to an infinite OOM loop or system stall.

Let's ignore memory.min of unpopulated cgroups.

Signed-off-by: Roman Gushchin <guro@...com>
Cc: Johannes Weiner <hannes@...xchg.org>
Cc: Michal Hocko <mhocko@...e.com>
Cc: Vladimir Davydov <vdavydov.dev@...il.com>
Cc: Tejun Heo <tj@...nel.org>
---
 mm/vmscan.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0a42ab1ce42b..e563d67de787 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2549,8 +2549,11 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
 				/*
 				 * Hard protection.
 				 * If there is no reclaimable memory, OOM.
+				 * Abandoned cgroups are loosing protection,
+				 * because OOM killer won't release any memory.
 				 */
-				continue;
+				if (cgroup_is_populated(memcg->css.cgroup))
+					continue;
 			case MEMCG_PROT_LOW:
 				/*
 				 * Soft protection.
-- 
2.14.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ