Re: [PATCH] cgroup/cpuset: fix circular locking dependency
From: Tejun Heo
Date: Mon Dec 11 2017 - 10:33:08 EST
Hello, Prateek.
On Fri, Dec 08, 2017 at 05:15:55PM +0530, Prateek Sood wrote:
> There is one deadlock issue during cgroup migration from cpu
> hotplug path when a task T is being moved from source to
> destination cgroup.
>
> kworker/0:0
> cpuset_hotplug_workfn()
> cpuset_hotplug_update_tasks()
> hotplug_update_tasks_legacy()
> remove_tasks_in_empty_cpuset()
> cgroup_transfer_tasks() // stuck in iterator loop
> cgroup_migrate()
> cgroup_migrate_add_task()
>
> In cgroup_migrate_add_task() it checks for PF_EXITING flag of task T.
> Task T will not migrate to destination cgroup. css_task_iter_start()
> will keep pointing to task T in loop waiting for task T cg_list node
> to be removed.
Heh, that's a bug in cgroup_transfer_tasks() which happened because I
forgot to update when we changed how we handle exiting tasks. The
right thing to do here is making cgroup_transfer_tasks() repeat iff
there were a valid migration target which didn't get transferred.
Thanks.
--
tejun