Pull scheduler fixes from Thomas Gleixner: "Two fixes for the fair scheduling class: - Prevent freeing memory which is accessible by concurrent readers - Make the RCU annotations for numa groups consistent" * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched/fair: Use RCU accessors consistently for ->numa_group sched/fair: Don't free p->numa_faults with concurrent readers
Showing the changes to include/linux (2 of 5 files). Show all
Unified · Split
| @@ -1092,7 +1092,15 @@ struct task_struct { · 1091 unmodified lines | ||
| 1092 | 1092 | u64 last_sum_exec_runtime; |
| 1093 | 1093 | struct callback_head numa_work; |
| 1094 | 1094 | |
| 1095 | − struct numa_group *numa_group; | |
| 1095 | + /* | |
| 1096 | + * This pointer is only modified for current in syscall and | |
| 1097 | + * pagefault context (and for tasks being destroyed), so it can be read | |
| 1098 | + * from any of the following contexts: | |
| 1099 | + * - RCU read-side critical section | |
| 1100 | + * - current->numa_group from everywhere | |
| 1101 | + * - task's runqueue locked, task not running | |
| 1102 | + */ | |
| 1103 | + struct numa_group __rcu *numa_group; | |
| 1096 | 1104 | |
| 1097 | 1105 | /* |
| 1098 | 1106 | * numa_faults is an array split into four regions: |
| @@ -19,7 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | extern void task_numa_fault(int last_node, int node, int pages, int flags); |
| 20 | 20 | extern pid_t task_numa_group_id(struct task_struct *p); |
| 21 | 21 | extern void set_numabalancing_state(bool enabled); |
| 22 | −extern void task_numa_free(struct task_struct *p); | |
| 22 | +extern void task_numa_free(struct task_struct *p, bool final); | |
| 23 | 23 | extern bool should_numa_migrate_memory(struct task_struct *p, struct page *page, |
| 24 | 24 | int src_nid, int dst_cpu); |
| 25 | 25 | #else |
| @@ -34,7 +34,7 @@ static inline pid_t task_numa_group_id(struct task_struct *p) · 8 unmodified lines | ||
| 34 | 34 | static inline void set_numabalancing_state(bool enabled) |
| 35 | 35 | { |
| 36 | 36 | } |
| 37 | −static inline void task_numa_free(struct task_struct *p) | |
| 37 | +static inline void task_numa_free(struct task_struct *p, bool final) | |
| 38 | 38 | { |
| 39 | 39 | } |
| 40 | 40 | static inline bool should_numa_migrate_memory(struct task_struct *p, |