cgroup: treat memory.oom_control specially too

Submitted by Tycho Andersen on Aug. 9, 2016, 9:28 p.m.

Details

Message ID 1470778123-13561-1-git-send-email-tycho.andersen@canonical.com
State Accepted
Series "cgroup: treat memory.oom_control specially too"
Commit edbf1919a8cc96c10952f775b23a54cd4c48338a
Headers show

Commit Message

Tycho Andersen Aug. 9, 2016, 9:28 p.m.
Similar to f444f7fac40, we need to treat memory.oom_control as a "special"
property and try not to write its default value, since in the 3.11 kernel
it can't be written when memory.use_heirarchy is true, which is the
default.

CC: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
---
 criu/cgroup.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/cgroup.c b/criu/cgroup.c
index 2f5b4d9..db3daad 100644
--- a/criu/cgroup.c
+++ b/criu/cgroup.c
@@ -949,6 +949,7 @@  static const char *special_props[] = {
 	"cpuset.mems",
 	"memory.kmem.limit_in_bytes",
 	"memory.swappiness",
+	"memory.oom_control",
 	"memory.use_hierarchy",
 	NULL,
 };
@@ -1425,12 +1426,16 @@  static int restore_special_props(char *paux, size_t off, CgroupDirEntry *e)
 
 			if (strcmp(name, prop->name) == 0) {
 				/* XXX: we can drop this hack and make
-				 * memory.swappiness a regular property when we
-				 * drop support for kernels < 3.16. See 3dae7fec5.
+				 * memory.swappiness and memory.oom_control
+				 * regular properties when we drop support for
+				 * kernels < 3.16. See 3dae7fec5.
 				 */
 				if (!strcmp(prop->name, "memory.swappiness") &&
 						!strcmp(prop->value, "60")) {
 					continue;
+				} else if (!strcmp(prop->name, "memory.oom_control") &&
+						!strcmp(prop->value, "0")) {
+					continue;
 				} else if (restore_cgroup_prop(prop, paux, off) < 0) {
 					return -1;
 				}

Comments

Pavel Emelianov Aug. 12, 2016, 10:03 a.m.
Applied