[Devel] [PATCH RH9 01/23] mm/memcg: enable memory.low for cgroup v1

Vasily Averin vvs at virtuozzo.com
Sun Sep 26 13:03:47 MSK 2021


This adds memory.low for cgroup v1. Semantics the same as
for cgroup v2.

Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
(cherry picked from commit 9ab48918d4587dc614595055e66e2e17af5c4a44)
VvS: rebase to rh9
https://jira.sw.ru/browse/PSBM-133990
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 mm/memcontrol.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 702a81dfe72d..0ad4b3906279 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4915,6 +4915,10 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
 	return ret;
 }
 
+static ssize_t memory_low_write(struct kernfs_open_file *of,
+				char *buf, size_t nbytes, loff_t off);
+static int memory_low_show(struct seq_file *m, void *v);
+
 static struct cftype mem_cgroup_legacy_files[] = {
 	{
 		.name = "usage_in_bytes",
@@ -4945,6 +4949,12 @@ static struct cftype mem_cgroup_legacy_files[] = {
 		.write = mem_cgroup_reset,
 		.read_u64 = mem_cgroup_read_u64,
 	},
+	{
+		.name = "low",
+		.flags = CFTYPE_NOT_ON_ROOT,
+		.write = memory_low_write,
+		.seq_show = memory_low_show,
+	},
 	{
 		.name = "stat",
 		.seq_show = memcg_stat_show,
-- 
2.25.1



More information about the Devel mailing list