diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 65 |
1 files changed, 55 insertions, 10 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 27519df0f987..1c30bc308ef1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -249,6 +249,36 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, | |||
249 | extern void arch_unmap_area(struct mm_struct *, unsigned long); | 249 | extern void arch_unmap_area(struct mm_struct *, unsigned long); |
250 | extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | 250 | extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); |
251 | 251 | ||
252 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS | ||
253 | /* | ||
254 | * The mm counters are not protected by its page_table_lock, | ||
255 | * so must be incremented atomically. | ||
256 | */ | ||
257 | #ifdef ATOMIC64_INIT | ||
258 | #define set_mm_counter(mm, member, value) atomic64_set(&(mm)->_##member, value) | ||
259 | #define get_mm_counter(mm, member) ((unsigned long)atomic64_read(&(mm)->_##member)) | ||
260 | #define add_mm_counter(mm, member, value) atomic64_add(value, &(mm)->_##member) | ||
261 | #define inc_mm_counter(mm, member) atomic64_inc(&(mm)->_##member) | ||
262 | #define dec_mm_counter(mm, member) atomic64_dec(&(mm)->_##member) | ||
263 | typedef atomic64_t mm_counter_t; | ||
264 | #else /* !ATOMIC64_INIT */ | ||
265 | /* | ||
266 | * The counters wrap back to 0 at 2^32 * PAGE_SIZE, | ||
267 | * that is, at 16TB if using 4kB page size. | ||
268 | */ | ||
269 | #define set_mm_counter(mm, member, value) atomic_set(&(mm)->_##member, value) | ||
270 | #define get_mm_counter(mm, member) ((unsigned long)atomic_read(&(mm)->_##member)) | ||
271 | #define add_mm_counter(mm, member, value) atomic_add(value, &(mm)->_##member) | ||
272 | #define inc_mm_counter(mm, member) atomic_inc(&(mm)->_##member) | ||
273 | #define dec_mm_counter(mm, member) atomic_dec(&(mm)->_##member) | ||
274 | typedef atomic_t mm_counter_t; | ||
275 | #endif /* !ATOMIC64_INIT */ | ||
276 | |||
277 | #else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ | ||
278 | /* | ||
279 | * The mm counters are protected by its page_table_lock, | ||
280 | * so can be incremented directly. | ||
281 | */ | ||
252 | #define set_mm_counter(mm, member, value) (mm)->_##member = (value) | 282 | #define set_mm_counter(mm, member, value) (mm)->_##member = (value) |
253 | #define get_mm_counter(mm, member) ((mm)->_##member) | 283 | #define get_mm_counter(mm, member) ((mm)->_##member) |
254 | #define add_mm_counter(mm, member, value) (mm)->_##member += (value) | 284 | #define add_mm_counter(mm, member, value) (mm)->_##member += (value) |
@@ -256,6 +286,20 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | |||
256 | #define dec_mm_counter(mm, member) (mm)->_##member-- | 286 | #define dec_mm_counter(mm, member) (mm)->_##member-- |
257 | typedef unsigned long mm_counter_t; | 287 | typedef unsigned long mm_counter_t; |
258 | 288 | ||
289 | #endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ | ||
290 | |||
291 | #define get_mm_rss(mm) \ | ||
292 | (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss)) | ||
293 | #define update_hiwater_rss(mm) do { \ | ||
294 | unsigned long _rss = get_mm_rss(mm); \ | ||
295 | if ((mm)->hiwater_rss < _rss) \ | ||
296 | (mm)->hiwater_rss = _rss; \ | ||
297 | } while (0) | ||
298 | #define update_hiwater_vm(mm) do { \ | ||
299 | if ((mm)->hiwater_vm < (mm)->total_vm) \ | ||
300 | (mm)->hiwater_vm = (mm)->total_vm; \ | ||
301 | } while (0) | ||
302 | |||
259 | struct mm_struct { | 303 | struct mm_struct { |
260 | struct vm_area_struct * mmap; /* list of VMAs */ | 304 | struct vm_area_struct * mmap; /* list of VMAs */ |
261 | struct rb_root mm_rb; | 305 | struct rb_root mm_rb; |
@@ -279,15 +323,20 @@ struct mm_struct { | |||
279 | * by mmlist_lock | 323 | * by mmlist_lock |
280 | */ | 324 | */ |
281 | 325 | ||
326 | /* Special counters, in some configurations protected by the | ||
327 | * page_table_lock, in other configurations by being atomic. | ||
328 | */ | ||
329 | mm_counter_t _file_rss; | ||
330 | mm_counter_t _anon_rss; | ||
331 | |||
332 | unsigned long hiwater_rss; /* High-watermark of RSS usage */ | ||
333 | unsigned long hiwater_vm; /* High-water virtual memory usage */ | ||
334 | |||
335 | unsigned long total_vm, locked_vm, shared_vm, exec_vm; | ||
336 | unsigned long stack_vm, reserved_vm, def_flags, nr_ptes; | ||
282 | unsigned long start_code, end_code, start_data, end_data; | 337 | unsigned long start_code, end_code, start_data, end_data; |
283 | unsigned long start_brk, brk, start_stack; | 338 | unsigned long start_brk, brk, start_stack; |
284 | unsigned long arg_start, arg_end, env_start, env_end; | 339 | unsigned long arg_start, arg_end, env_start, env_end; |
285 | unsigned long total_vm, locked_vm, shared_vm; | ||
286 | unsigned long exec_vm, stack_vm, reserved_vm, def_flags, nr_ptes; | ||
287 | |||
288 | /* Special counters protected by the page_table_lock */ | ||
289 | mm_counter_t _rss; | ||
290 | mm_counter_t _anon_rss; | ||
291 | 340 | ||
292 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ | 341 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ |
293 | 342 | ||
@@ -308,11 +357,7 @@ struct mm_struct { | |||
308 | /* aio bits */ | 357 | /* aio bits */ |
309 | rwlock_t ioctx_list_lock; | 358 | rwlock_t ioctx_list_lock; |
310 | struct kioctx *ioctx_list; | 359 | struct kioctx *ioctx_list; |
311 | |||
312 | struct kioctx default_kioctx; | 360 | struct kioctx default_kioctx; |
313 | |||
314 | unsigned long hiwater_rss; /* High-water RSS usage */ | ||
315 | unsigned long hiwater_vm; /* High-water virtual memory usage */ | ||
316 | }; | 361 | }; |
317 | 362 | ||
318 | struct sighand_struct { | 363 | struct sighand_struct { |