diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2010-03-05 16:41:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-06 14:26:23 -0500 |
commit | d559db086ff5be9bcc259e5aa50bf3d881eaf1d1 (patch) | |
tree | aa968c8a4093234e4623a34c0415bf9d8683671c /include/linux/sched.h | |
parent | 19b629f581320999ddb9f6597051b79cdb53459c (diff) |
mm: clean up mm_counter
Presently, per-mm statistics counter is defined by macro in sched.h
This patch modifies it to
- defined in mm.h as inlinf functions
- use array instead of macro's name creation.
This patch is for reducing patch size in future patch to modify
implementation of per-mm counter.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4b1753f7e48e..cbeafa49a53b 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -396,60 +396,6 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | |||
396 | static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} | 396 | static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} |
397 | #endif | 397 | #endif |
398 | 398 | ||
399 | #if USE_SPLIT_PTLOCKS | ||
400 | /* | ||
401 | * The mm counters are not protected by its page_table_lock, | ||
402 | * so must be incremented atomically. | ||
403 | */ | ||
404 | #define set_mm_counter(mm, member, value) atomic_long_set(&(mm)->_##member, value) | ||
405 | #define get_mm_counter(mm, member) ((unsigned long)atomic_long_read(&(mm)->_##member)) | ||
406 | #define add_mm_counter(mm, member, value) atomic_long_add(value, &(mm)->_##member) | ||
407 | #define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member) | ||
408 | #define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member) | ||
409 | |||
410 | #else /* !USE_SPLIT_PTLOCKS */ | ||
411 | /* | ||
412 | * The mm counters are protected by its page_table_lock, | ||
413 | * so can be incremented directly. | ||
414 | */ | ||
415 | #define set_mm_counter(mm, member, value) (mm)->_##member = (value) | ||
416 | #define get_mm_counter(mm, member) ((mm)->_##member) | ||
417 | #define add_mm_counter(mm, member, value) (mm)->_##member += (value) | ||
418 | #define inc_mm_counter(mm, member) (mm)->_##member++ | ||
419 | #define dec_mm_counter(mm, member) (mm)->_##member-- | ||
420 | |||
421 | #endif /* !USE_SPLIT_PTLOCKS */ | ||
422 | |||
423 | #define get_mm_rss(mm) \ | ||
424 | (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss)) | ||
425 | #define update_hiwater_rss(mm) do { \ | ||
426 | unsigned long _rss = get_mm_rss(mm); \ | ||
427 | if ((mm)->hiwater_rss < _rss) \ | ||
428 | (mm)->hiwater_rss = _rss; \ | ||
429 | } while (0) | ||
430 | #define update_hiwater_vm(mm) do { \ | ||
431 | if ((mm)->hiwater_vm < (mm)->total_vm) \ | ||
432 | (mm)->hiwater_vm = (mm)->total_vm; \ | ||
433 | } while (0) | ||
434 | |||
435 | static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm) | ||
436 | { | ||
437 | return max(mm->hiwater_rss, get_mm_rss(mm)); | ||
438 | } | ||
439 | |||
440 | static inline void setmax_mm_hiwater_rss(unsigned long *maxrss, | ||
441 | struct mm_struct *mm) | ||
442 | { | ||
443 | unsigned long hiwater_rss = get_mm_hiwater_rss(mm); | ||
444 | |||
445 | if (*maxrss < hiwater_rss) | ||
446 | *maxrss = hiwater_rss; | ||
447 | } | ||
448 | |||
449 | static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm) | ||
450 | { | ||
451 | return max(mm->hiwater_vm, mm->total_vm); | ||
452 | } | ||
453 | 399 | ||
454 | extern void set_dumpable(struct mm_struct *mm, int value); | 400 | extern void set_dumpable(struct mm_struct *mm, int value); |
455 | extern int get_dumpable(struct mm_struct *mm); | 401 | extern int get_dumpable(struct mm_struct *mm); |