summaryrefslogtreecommitdiffstats
path: root/include/linux/cgroup.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2019-05-31 10:38:58 -0700
committerTejun Heo <tj@kernel.org>2019-05-31 10:38:58 -0700
commitb636fd38dc40113f853337a7d2a6885ad23b8811 (patch)
tree4cce96a0cd2f756d1ef07a22afa0766508121b10 /include/linux/cgroup.h
parent6b115bf58e6f013ca75e7115aabcbd56c20ff31d (diff)
downloadlinux-b636fd38dc40113f853337a7d2a6885ad23b8811.tar.gz
linux-b636fd38dc40113f853337a7d2a6885ad23b8811.tar.bz2
linux-b636fd38dc40113f853337a7d2a6885ad23b8811.zip
cgroup: Implement css_task_iter_skip()
When a task is moved out of a cset, task iterators pointing to the task are advanced using the normal css_task_iter_advance() call. This is fine but we'll be tracking dying tasks on csets and thus moving tasks from cset->tasks to (to be added) cset->dying_tasks. When we remove a task from cset->tasks, if we advance the iterators, they may move over to the next cset before we had the chance to add the task back on the dying list, which can allow the task to escape iteration. This patch separates out skipping from advancing. Skipping only moves the affected iterators to the next pointer rather than fully advancing it and the following advancing will recognize that the cursor has already been moved forward and do the rest of advancing. This ensures that when a task moves from one list to another in its cset, as long as it moves in the right direction, it's always visible to iteration. This doesn't cause any visible behavior changes. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Oleg Nesterov <oleg@redhat.com>
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r--include/linux/cgroup.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index a7e4611e20c8..05ed2a209e74 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -43,6 +43,9 @@
/* walk all threaded css_sets in the domain */
#define CSS_TASK_ITER_THREADED (1U << 1)
+/* internal flags */
+#define CSS_TASK_ITER_SKIPPED (1U << 16)
+
/* a css_task_iter should be treated as an opaque object */
struct css_task_iter {
struct cgroup_subsys *ss;