lkml.org 
[lkml]   [2010]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] exit: fix oops in sync_mm_rss
On Wed, 31 Mar 2010 11:53:00 +0900 Minchan Kim <minchan.kim@gmail.com> wrote:

> >> I think we should do this too:
> >>
> >> --- a/mm/memory.c~exit-fix-oops-in-sync_mm_rss-fix
> >> +++ a/mm/memory.c
> >> @@ -131,7 +131,6 @@ static void __sync_task_rss_stat(struct
> >>
> >> __ __ __ for (i = 0; i < NR_MM_COUNTERS; i++) {
> >> __ __ __ __ __ __ __ if (task->rss_stat.count[i]) {
> >> - __ __ __ __ __ __ __ __ __ __ BUG_ON(!mm);
> >> __ __ __ __ __ __ __ __ __ __ __ add_mm_counter(mm, i, task->rss_stat.count[i]);
> >> __ __ __ __ __ __ __ __ __ __ __ task->rss_stat.count[i] = 0;
> >> __ __ __ __ __ __ __ }

^^ gargh, gmail.

> >>
> >> Because we just made sure it can't happen, and if it _does_ happen, the
> >> oops will tell us the samme thing that the BUG_ON() would have.
> >>
> >
> > Hmm, then, finaly..
> > ==
> >
> > task->rss_stat wasn't initialized to 0 at copy_process().
> > And __sync_task_rss_stat() should be static.
> > removed BUG_ON(!mm) in __sync_task_rss_stat() for avoiding to show
> > wrong information to code readers. Anyway, if !mm && task->rss_stat
> > has some value, panic will happen.
> >
> > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Reviewed-by: Minchan Kim <minchan.kim@gmail.com>

I think we should keep the

--- a/kernel/exit.c~exit-fix-oops-in-sync_mm_rss
+++ a/kernel/exit.c
@@ -953,7 +953,8 @@ NORET_TYPE void do_exit(long code)

acct_update_integrals(tsk);
/* sync mm's RSS info before statistics gathering */
- sync_mm_rss(tsk, tsk->mm);
+ if (tsk->mm)
+ sync_mm_rss(tsk, tsk->mm);
group_dead = atomic_dec_and_test(&tsk->signal->live);
if (group_dead) {
hrtimer_cancel(&tsk->signal->real_timer);
really. Apart from the fact that we'll otherwise perform an empty
NR_MM_COUNTERS loop in __sync_task_rss_stat(), sync_mm_rss() just isn't
set up to handle kernel threads. Given that the function of
sync_task_mm(from, to) is to move stuff from "from" and into "to", it's
daft to call it with a NULL value of `to'!



\
 
 \ /
  Last update: 2010-03-31 05:07    [W:0.112 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site