diff options
Diffstat (limited to 'include/linux/cpuset.h')
-rw-r--r-- | include/linux/cpuset.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index a73454aec333..457ed765a116 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
@@ -69,6 +69,7 @@ extern void cpuset_task_status_allowed(struct seq_file *m, | |||
69 | struct task_struct *task); | 69 | struct task_struct *task); |
70 | 70 | ||
71 | extern int cpuset_mem_spread_node(void); | 71 | extern int cpuset_mem_spread_node(void); |
72 | extern int cpuset_slab_spread_node(void); | ||
72 | 73 | ||
73 | static inline int cpuset_do_page_mem_spread(void) | 74 | static inline int cpuset_do_page_mem_spread(void) |
74 | { | 75 | { |
@@ -86,9 +87,44 @@ extern void rebuild_sched_domains(void); | |||
86 | 87 | ||
87 | extern void cpuset_print_task_mems_allowed(struct task_struct *p); | 88 | extern void cpuset_print_task_mems_allowed(struct task_struct *p); |
88 | 89 | ||
90 | /* | ||
91 | * reading current mems_allowed and mempolicy in the fastpath must protected | ||
92 | * by get_mems_allowed() | ||
93 | */ | ||
94 | static inline void get_mems_allowed(void) | ||
95 | { | ||
96 | current->mems_allowed_change_disable++; | ||
97 | |||
98 | /* | ||
99 | * ensure that reading mems_allowed and mempolicy happens after the | ||
100 | * update of ->mems_allowed_change_disable. | ||
101 | * | ||
102 | * the write-side task finds ->mems_allowed_change_disable is not 0, | ||
103 | * and knows the read-side task is reading mems_allowed or mempolicy, | ||
104 | * so it will clear old bits lazily. | ||
105 | */ | ||
106 | smp_mb(); | ||
107 | } | ||
108 | |||
109 | static inline void put_mems_allowed(void) | ||
110 | { | ||
111 | /* | ||
112 | * ensure that reading mems_allowed and mempolicy before reducing | ||
113 | * mems_allowed_change_disable. | ||
114 | * | ||
115 | * the write-side task will know that the read-side task is still | ||
116 | * reading mems_allowed or mempolicy, don't clears old bits in the | ||
117 | * nodemask. | ||
118 | */ | ||
119 | smp_mb(); | ||
120 | --ACCESS_ONCE(current->mems_allowed_change_disable); | ||
121 | } | ||
122 | |||
89 | static inline void set_mems_allowed(nodemask_t nodemask) | 123 | static inline void set_mems_allowed(nodemask_t nodemask) |
90 | { | 124 | { |
125 | task_lock(current); | ||
91 | current->mems_allowed = nodemask; | 126 | current->mems_allowed = nodemask; |
127 | task_unlock(current); | ||
92 | } | 128 | } |
93 | 129 | ||
94 | #else /* !CONFIG_CPUSETS */ | 130 | #else /* !CONFIG_CPUSETS */ |
@@ -159,6 +195,11 @@ static inline int cpuset_mem_spread_node(void) | |||
159 | return 0; | 195 | return 0; |
160 | } | 196 | } |
161 | 197 | ||
198 | static inline int cpuset_slab_spread_node(void) | ||
199 | { | ||
200 | return 0; | ||
201 | } | ||
202 | |||
162 | static inline int cpuset_do_page_mem_spread(void) | 203 | static inline int cpuset_do_page_mem_spread(void) |
163 | { | 204 | { |
164 | return 0; | 205 | return 0; |
@@ -187,6 +228,14 @@ static inline void set_mems_allowed(nodemask_t nodemask) | |||
187 | { | 228 | { |
188 | } | 229 | } |
189 | 230 | ||
231 | static inline void get_mems_allowed(void) | ||
232 | { | ||
233 | } | ||
234 | |||
235 | static inline void put_mems_allowed(void) | ||
236 | { | ||
237 | } | ||
238 | |||
190 | #endif /* !CONFIG_CPUSETS */ | 239 | #endif /* !CONFIG_CPUSETS */ |
191 | 240 | ||
192 | #endif /* _LINUX_CPUSET_H */ | 241 | #endif /* _LINUX_CPUSET_H */ |