summaryrefslogtreecommitdiff
path: root/kernel/cgroup/cgroup-internal.h
diff options
context:
space:
mode:
authorYi Tao <escape@linux.alibaba.com>2025-09-10 14:59:33 +0800
committerTejun Heo <tj@kernel.org>2025-09-10 07:26:15 -1000
commita1ffc8ad3165fa1cf6a60c6a4b4e00dfd6603cf2 (patch)
tree5b595ec5e5c0a1a30aae26e0847c1e42af657634 /kernel/cgroup/cgroup-internal.h
parent4a3e62dfa7b79dc8f759219fe64318ff08e98013 (diff)
cgroup: refactor the cgroup_attach_lock code to make it clearer
Dynamic cgroup migration involving threadgroup locks can be in one of two states: no lock held, or holding the global lock. Explicitly declaring the different lock modes to make the code easier to understand and facilitates future extensions of the lock modes. Signed-off-by: Yi Tao <escape@linux.alibaba.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/cgroup/cgroup-internal.h')
-rw-r--r--kernel/cgroup/cgroup-internal.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h
index b14e61c64a34..a6d6f30b6f65 100644
--- a/kernel/cgroup/cgroup-internal.h
+++ b/kernel/cgroup/cgroup-internal.h
@@ -249,12 +249,13 @@ int cgroup_migrate(struct task_struct *leader, bool threadgroup,
int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader,
bool threadgroup);
-void cgroup_attach_lock(bool lock_threadgroup);
-void cgroup_attach_unlock(bool lock_threadgroup);
+void cgroup_attach_lock(enum cgroup_attach_lock_mode lock_mode);
+void cgroup_attach_unlock(enum cgroup_attach_lock_mode lock_mode);
struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup,
- bool *locked)
+ enum cgroup_attach_lock_mode *lock_mode)
__acquires(&cgroup_threadgroup_rwsem);
-void cgroup_procs_write_finish(struct task_struct *task, bool locked)
+void cgroup_procs_write_finish(struct task_struct *task,
+ enum cgroup_attach_lock_mode lock_mode)
__releases(&cgroup_threadgroup_rwsem);
void cgroup_lock_and_drain_offline(struct cgroup *cgrp);