]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
cgroup: Implement css_task_iter_skip()
authorTejun Heo <tj@kernel.org>
Fri, 31 May 2019 17:38:58 +0000 (10:38 -0700)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 17 Sep 2019 16:02:18 +0000 (18:02 +0200)
commit3995c283ae08dfadabbd89db47934dfa06606ead
tree5333282fbfb8b2d77bbd52dfd773106edf0f9a15
parent9f698e2189d859cc77b84e97b78a5928ebd242ac
cgroup: Implement css_task_iter_skip()

BugLink: https://bugs.launchpad.net/bugs/1840378
commit b636fd38dc40113f853337a7d2a6885ad23b8811 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
include/linux/cgroup.h
kernel/cgroup/cgroup.c