History

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.

Juri Lelli committed 7 years ago

Commit 710da3c1 parent 1a763fd3 files · +33 −3Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/cpuset.h+5−0
@@ -55,6 +55,8 @@ extern void cpuset_init_smp(void); · 54 unmodified lines
5555 extern void cpuset_force_rebuild(void);
5656 extern void cpuset_update_active_cpus(void);
5757 extern void cpuset_wait_for_hotplug(void);
58+extern void cpuset_read_lock(void);
59+extern void cpuset_read_unlock(void);
5860 extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
5961 extern void cpuset_cpus_allowed_fallback(struct task_struct *p);
6062 extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
@@ -176,6 +178,9 @@ static inline void cpuset_update_active_cpus(void) · 115 unmodified lines
176178
177179 static inline void cpuset_wait_for_hotplug(void) { }
178180
181+static inline void cpuset_read_lock(void) { }
182+static inline void cpuset_read_unlock(void) { }
183+
179184 static inline void cpuset_cpus_allowed(struct task_struct *p,
180185 struct cpumask *mask)
181186 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t