Repository navigation
Commit 710da3c
sched/core: Prevent race condition between cpuset and __sched_setscheduler()
No synchronisation mechanism exists between the cpuset subsystem and
calls to function __sched_setscheduler(). As such, it is possible that
new root domains are created on the cpuset side while a deadline
acceptance test is carried out in __sched_setscheduler(), leading to a
potential oversell of CPU bandwidth.
Grab cpuset_rwsem read lock from core scheduler, so to prevent
situations such as the one described above from happening.
The only exception is normalize_rt_tasks() which needs to work under
tasklist_lock and can't therefore grab cpuset_rwsem. We are fine with
this, as this function is only called by sysrq and, if that gets
triggered, DEADLINE guarantees are already gone out of the window
anyway.
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: bristot@redhat.com
Cc: claudio@evidence.eu.com
Cc: lizefan@huawei.com
Cc: longman@redhat.com
Cc: luca.abeni@santannapisa.it
Cc: mathieu.poirier@linaro.org
Cc: rostedt@goodmis.org
Cc: tj@kernel.org
Cc: tommaso.cucinotta@santannapisa.it
Link: https://lkml.kernel.org/r/20190719140000.31694-9-juri.lelli@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>1 parent 1a763fd commit 710da3c
3 files changed
Lines changed: 33 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
176 | 178 | | |
177 | 179 | | |
178 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
179 | 184 | | |
180 | 185 | | |
181 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
337 | 348 | | |
338 | 349 | | |
339 | 350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4698 | 4698 | | |
4699 | 4699 | | |
4700 | 4700 | | |
| 4701 | + | |
| 4702 | + | |
| 4703 | + | |
4701 | 4704 | | |
4702 | 4705 | | |
4703 | 4706 | | |
| |||
4772 | 4775 | | |
4773 | 4776 | | |
4774 | 4777 | | |
| 4778 | + | |
| 4779 | + | |
4775 | 4780 | | |
4776 | 4781 | | |
4777 | 4782 | | |
| |||
4832 | 4837 | | |
4833 | 4838 | | |
4834 | 4839 | | |
4835 | | - | |
| 4840 | + | |
| 4841 | + | |
4836 | 4842 | | |
| 4843 | + | |
4837 | 4844 | | |
4838 | 4845 | | |
4839 | 4846 | | |
| |||
4843 | 4850 | | |
4844 | 4851 | | |
4845 | 4852 | | |
| 4853 | + | |
| 4854 | + | |
4846 | 4855 | | |
4847 | 4856 | | |
4848 | 4857 | | |
| |||
4927 | 4936 | | |
4928 | 4937 | | |
4929 | 4938 | | |
4930 | | - | |
4931 | | - | |
| 4939 | + | |
| 4940 | + | |
4932 | 4941 | | |
4933 | 4942 | | |
| 4943 | + | |
| 4944 | + | |
| 4945 | + | |
| 4946 | + | |
| 4947 | + | |
4934 | 4948 | | |
4935 | 4949 | | |
4936 | 4950 | | |
| |||
0 commit comments