Commit a99ce69
committed
cgroup: Migrate tasks to the root css when a controller is rebound
cgroup_apply_control_disable() defers kill_css_finish() while a css is
still populated, relying on css_update_populated() to fire the deferred
kill once the populated count reaches zero.
This deadlocks when a controller is rebound out of a hierarchy. Mounting
an implicit_on_dfl controller such as perf_event as a v1 hierarchy steals
it off the default hierarchy, and rebind_subsystems() kills its
per-cgroup csses while they are still populated. The migration run in the
same step keeps the old css for a controller no longer in the hierarchy's
mask, so no task is migrated off the dying csses. Their populated count
never reaches zero, the deferred kill_css_finish() never fires, and the
next cgroup_lock_and_drain_offline() hangs forever under cgroup_mutex.
That migration is already a no-op pass over the rebound subtree. Add
cgroup_rebind_ss_mask so find_existing_css_set() resolves the leaving
controllers to the root css. Their tasks are migrated there, the
per-cgroup csses depopulate, and cgroup_apply_control_disable() kills
them synchronously. The deferral stays correct for the rmdir and
controller-disable paths it was meant for.
Fixes: 1dffd95 ("cgroup: Defer kill_css_finish() in cgroup_apply_control_disable()")
Reported-by: Mark Brown <broonie@kernel.org>
Closes: https://lore.kernel.org/all/41cd159c-54e5-45e0-81df-eaf36a6c028e@sirena.org.uk/
Reported-by: Bert Karwatzki <spasswolf@web.de>
Closes: https://lore.kernel.org/all/4e986b4ed7e16547805d54b6e67d09120bc4d2f2.camel@web.de/
Tested-by: Mark Brown <broonie@kernel.org>
Tested-by: Bert Karwatzki <spasswolf@web.de>
Signed-off-by: Tejun Heo <tj@kernel.org>1 parent 6935f04 commit a99ce69
1 file changed
Lines changed: 31 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
200 | 208 | | |
201 | 209 | | |
202 | 210 | | |
| |||
1083 | 1091 | | |
1084 | 1092 | | |
1085 | 1093 | | |
1086 | | - | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
1087 | 1103 | | |
1088 | 1104 | | |
1089 | 1105 | | |
| |||
1853 | 1869 | | |
1854 | 1870 | | |
1855 | 1871 | | |
1856 | | - | |
1857 | | - | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
1858 | 1878 | | |
1859 | 1879 | | |
| 1880 | + | |
1860 | 1881 | | |
| 1882 | + | |
1861 | 1883 | | |
1862 | 1884 | | |
1863 | 1885 | | |
| |||
1871 | 1893 | | |
1872 | 1894 | | |
1873 | 1895 | | |
1874 | | - | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
1875 | 1900 | | |
| 1901 | + | |
1876 | 1902 | | |
| 1903 | + | |
1877 | 1904 | | |
1878 | 1905 | | |
1879 | 1906 | | |
| |||
0 commit comments