From: Shaun Tancheff <shaun.tancheff@gmail.com>
To: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Shaun Tancheff <shaun@tancheff.com>,
Andrew Morton <akpm@linux-foundation.org>,
cgroups@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
"stable @ vger . kernel . org . Shaun Tancheff"
<shaun.tancheff@hpe.com>
Subject: [PATCH] memcg: Set memory min, low, high values along with max
Date: Fri, 31 Mar 2023 03:22:32 +0700 [thread overview]
Message-ID: <20230330202232.355471-1-shaun.tancheff@gmail.com> (raw)
From: Shaun Tancheff <shaun@tancheff.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@hpe.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
next reply other threads:[~2023-03-30 20:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 20:22 Shaun Tancheff [this message]
2023-03-31 8:40 ` [PATCH] memcg: Set memory min, low, high values along with max Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230330202232.355471-1-shaun.tancheff@gmail.com \
--to=shaun.tancheff@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=shaun.tancheff@hpe.com \
--cc=shaun@tancheff.com \
--cc=vdavydov.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).