Commit b1bcaed
cpuset: Treat cpusets in attaching as populated
Currently, the check for whether a partition is populated does not
account for tasks in the cpuset of attaching. This is a corner case
that can leave a task stuck in a partition with no effective CPUs.
The race condition occurs as follows:
cpu0 cpu1
//cpuset A with cpu N
migrate task p to A
cpuset_can_attach
// with effective cpus
// check ok
// cpuset_mutex is not held // clear cpuset.cpus.exclusive
// making effective cpus empty
update_exclusive_cpumask
// tasks_nocpu_error check ok
// empty effective cpus, partition valid
cpuset_attach
...
// task p stays in A, with non-effective cpus.
To fix this issue, this patch introduces cs_is_populated, which considers
tasks in the attaching cpuset. This new helper is used in validate_change
and partition_is_populated.
Fixes: e2d5990 ("cgroup/cpuset: Allow no-task partition to have empty cpuset.cpus.effective")
Signed-off-by: Chen Ridong <[email protected]>
Reviewed-by: Waiman Long <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>1 parent 318e18e commit b1bcaed
1 file changed
+27
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
359 | 368 | | |
360 | 369 | | |
361 | 370 | | |
| |||
373 | 382 | | |
374 | 383 | | |
375 | 384 | | |
376 | | - | |
377 | | - | |
| 385 | + | |
| 386 | + | |
378 | 387 | | |
379 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
380 | 395 | | |
381 | 396 | | |
382 | 397 | | |
383 | | - | |
384 | | - | |
| 398 | + | |
| 399 | + | |
385 | 400 | | |
386 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
387 | 404 | | |
388 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
389 | 408 | | |
390 | 409 | | |
391 | 410 | | |
| |||
670 | 689 | | |
671 | 690 | | |
672 | 691 | | |
673 | | - | |
| 692 | + | |
674 | 693 | | |
675 | 694 | | |
676 | 695 | | |
| |||
0 commit comments