[Devel] [VZ8 PATCH 3/3] cgroup: port CGROUP_REMOVED flag from vz7

Valeriy Vdovin valeriy.vdovin at virtuozzo.com
Mon Jan 18 21:08:28 MSK 2021


The flag will be used in subsequent porting patches for release_agent
functionality
Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
---
 include/linux/cgroup-defs.h | 2 ++
 include/linux/cgroup.h      | 5 +++++
 kernel/cgroup/cgroup.c      | 1 +
 3 files changed, 8 insertions(+)

diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index a3b309ab1a90..5ee5f10e3de7 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -57,6 +57,8 @@ enum {
 
 /* bits in struct cgroup flags field */
 enum {
+	/* Control Cgroup is dead */
+	CGRP_REMOVED,
 	/* Control Group requires release notifications to userspace */
 	CGRP_NOTIFY_ON_RELEASE,
 	/*
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index c0a42c3d43fa..dfd9460986ee 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -922,6 +922,11 @@ static inline bool cgroup_task_frozen(struct task_struct *task)
 	return task->frozen;
 }
 
+static inline int cgroup_is_removed(const struct cgroup *cgrp)
+{
+	return test_bit(CGRP_REMOVED, &cgrp->flags);
+}
+
 #else /* !CONFIG_CGROUPS */
 
 static inline void cgroup_enter_frozen(void) { }
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 797a3971ab46..447c8f003496 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -5562,6 +5562,7 @@ static int cgroup_destroy_locked(struct cgroup *cgrp)
 			tcgrp->freezer.nr_frozen_descendants--;
 	}
 	spin_unlock_irq(&css_set_lock);
+	set_bit(CGRP_REMOVED, &cgrp->flags);
 
 	cgroup1_check_for_release(parent);
 
-- 
2.27.0



More information about the Devel mailing list