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-next>] [day] [month] [year] [list]
Message-Id: <20230330202232.355471-1-shaun.tancheff@gmail.com>
Date:   Fri, 31 Mar 2023 03:22:32 +0700
From:   Shaun Tancheff <shaun.tancheff@...il.com>
To:     Johannes Weiner <hannes@...xchg.org>,
        Michal Hocko <mhocko@...nel.org>,
        Vladimir Davydov <vdavydov.dev@...il.com>
Cc:     Shaun Tancheff <shaun@...cheff.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        cgroups@...r.kernel.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org,
        "stable @ vger . kernel . org . Shaun Tancheff" 
        <shaun.tancheff@....com>
Subject: [PATCH] memcg: Set memory min, low, high values along with max

From: Shaun Tancheff <shaun@...cheff.com>

memcg-v1 does not expose memory min, low, and high.

These values should to be set to reasonable non-zero values
when max is set.

This patch sets them to 10%, 20% and 80% respective to max.

This fixes an issue with memory pressure with file systems
do an unbounded high rate of I/O hitting oom.

Signed-off-by: Shaun Tancheff <shaun.tancheff@....com>
---
 mm/memcontrol.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 2eee092f8f11..0f5918d9dd2a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3491,6 +3491,15 @@ static int mem_cgroup_resize_max(struct mem_cgroup *memcg,
 		if (max > counter->max)
 			enlarge = true;
 		ret = page_counter_set_max(counter, max);
+		if (!ret && !memsw) {
+			unsigned long min = (max / 10) + 1;
+			unsigned long low = min * 2;
+			unsigned long high = max - low;
+
+			page_counter_set_min(counter, min);
+			page_counter_set_low(counter, low);
+			page_counter_set_high(counter, high);
+		}
 		mutex_unlock(&memcg_max_mutex);
 
 		if (!ret)
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ