Commit 46d6227e authored by Jiri Pirko's avatar Jiri Pirko Committed by James Toy

(resend, repetitive patterns put into an inline function - not using max macro

 because it's was decided not to use it in previous conversation)

Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 86610bb4
...@@ -845,12 +845,8 @@ static int de_thread(struct task_struct *tsk) ...@@ -845,12 +845,8 @@ static int de_thread(struct task_struct *tsk)
sig->notify_count = 0; sig->notify_count = 0;
no_thread_group: no_thread_group:
if (current->mm) { if (current->mm)
unsigned long hiwater_rss = get_mm_hiwater_rss(current->mm); setmax_mm_hiwater_rss(&sig->maxrss, current->mm);
if (sig->maxrss < hiwater_rss)
sig->maxrss = hiwater_rss;
}
exit_itimers(sig); exit_itimers(sig);
flush_itimer_signals(); flush_itimer_signals();
......
...@@ -425,6 +425,15 @@ static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm) ...@@ -425,6 +425,15 @@ static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)
return max(mm->hiwater_rss, get_mm_rss(mm)); return max(mm->hiwater_rss, get_mm_rss(mm));
} }
static inline void setmax_mm_hiwater_rss(unsigned long *maxrss,
struct mm_struct *mm)
{
unsigned long hiwater_rss = get_mm_hiwater_rss(mm);
if (*maxrss < hiwater_rss)
*maxrss = hiwater_rss;
}
static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm) static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm)
{ {
return max(mm->hiwater_vm, mm->total_vm); return max(mm->hiwater_vm, mm->total_vm);
......
...@@ -945,12 +945,8 @@ NORET_TYPE void do_exit(long code) ...@@ -945,12 +945,8 @@ NORET_TYPE void do_exit(long code)
if (group_dead) { if (group_dead) {
hrtimer_cancel(&tsk->signal->real_timer); hrtimer_cancel(&tsk->signal->real_timer);
exit_itimers(tsk->signal); exit_itimers(tsk->signal);
if (tsk->mm) { if (tsk->mm)
unsigned long hiwater_rss = get_mm_hiwater_rss(tsk->mm); setmax_mm_hiwater_rss(&tsk->signal->maxrss, tsk->mm);
if (tsk->signal->maxrss < hiwater_rss)
tsk->signal->maxrss = hiwater_rss;
}
} }
acct_collect(code, group_dead); acct_collect(code, group_dead);
if (group_dead) if (group_dead)
......
...@@ -1401,10 +1401,7 @@ out: ...@@ -1401,10 +1401,7 @@ out:
if (who != RUSAGE_CHILDREN) { if (who != RUSAGE_CHILDREN) {
struct mm_struct *mm = get_task_mm(p); struct mm_struct *mm = get_task_mm(p);
if (mm) { if (mm) {
unsigned long hiwater_rss = get_mm_hiwater_rss(mm); setmax_mm_hiwater_rss(&maxrss, mm);
if (maxrss < hiwater_rss)
maxrss = hiwater_rss;
mmput(mm); mmput(mm);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment