get_mm_hiwater_xxx: trivial, s/define/inline/
PATCH 1/1 get_mm_hiwater_xxx: trivial, s/define/inline/
(sorry! forgot to save this patch)
Andrew pointed out get_mm_hiwater_xxx() evaluate "mm" argument thrice/twice, make them inline.
Signed-off-by Oleg Nesterov <[email protected]>
include/linux/sched.h renamed from include/linux/sched.h~CLEANUP +9 -2
@@ -388,8 +388,15 @@ extern void arch_unmap_area_topdown(stru (mm)->hiwater_vm = (mm)->total_vm; \ }while (0 ) -#define get_mm_hiwater_rss (mm) max((mm)->hiwater_rss, get_mm_rss(mm)) -#define get_mm_hiwater_vm (mm) max((mm)->hiwater_vm, (mm)->total_vm) +static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm) +{ +return max (mm->hiwater_rss,get_mm_rss (mm)); +} + +static inline unsigned long get_mm_hiwater_vm (struct mm_struct *mm) +{ +return max (mm->hiwater_vm, mm->total_vm); +}extern void set_dumpable (struct mm_struct *mm,int value);extern int get_dumpable (struct mm_struct *mm);
include/linux/sched.h extern void arch_unmap_area_topdown(stru · line 399
Quoted 11 lines
include/linux/sched.h renamed from include/linux/sched.h~CLEANUP +9
-2-#define get_mm_hiwater_rss (mm) max((mm)->hiwater_rss, get_mm_rss(mm)) -#define get_mm_hiwater_vm (mm) max((mm)->hiwater_vm, (mm)->total_vm) +static inline unsigned long get_mm_hiwater_rss (struct mm_struct *mm) +{ +return max (mm->hiwater_rss,get_mm_rss (mm)); +} + +static inline unsigned long get_mm_hiwater_vm (struct mm_struct *mm) +{ +return max (mm->hiwater_vm, mm->total_vm); +}
looks good to me.
Reviewed-by KOSAKI Motohiro <[email protected]>