[CRIU] [PATCH] cgroup: treat memory.oom_control specially too

Tycho Andersen tycho.andersen at canonical.com
Tue Aug 9 14:28:43 PDT 2016


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 at virtuozzo.com>
Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 criu/cgroup.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

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;
 				}
-- 
2.7.4



More information about the CRIU mailing list