linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Hugh Dickins <hughd@google.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	"kamezawa.hiroyu@jp.fujitsu.com" <kamezawa.hiroyu@jp.fujitsu.com>,
	"markus@trippelsdorf.de" <markus@trippelsdorf.de>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [patch 12/12] mm: correctly synchronize rss-counters at exit/exec
Date: Fri, 8 Jun 2012 14:24:59 +0200	[thread overview]
Message-ID: <20120608122459.GB23147@redhat.com> (raw)
In-Reply-To: <4FD1D1F7.2090503@openvz.org>

On 06/08, Konstantin Khlebnikov wrote:
>
> As result you can see "BUG: Bad rss-counter state mm:ffff88040783a680 idx:1 val:-1" in dmesg
>
> There left only one problem: nobody calls sync_mm_rss() after put_user() in mm_release().

Both callers call sync_mm_rss() to make check_mm() happy. But please
see the changelog, I think we should move it into mm_release(). See
the patch below (on top of v2 I sent). I need to recheck.

As for xacct_add_tsk(), yes it can "miss" that put_user(). But this
is what we have now, I think we do not care.

Oleg.

--- x/fs/exec.c
+++ x/fs/exec.c
@@ -822,7 +822,6 @@ static int exec_mmap(struct mm_struct *m
 	mm_release(tsk, old_mm);
 
 	if (old_mm) {
-		sync_mm_rss(old_mm);
 		/*
 		 * Make sure that if there is a core dump in progress
 		 * for the old mm, we get out and die instead of going
--- x/kernel/exit.c
+++ x/kernel/exit.c
@@ -656,7 +656,6 @@ static void exit_mm(struct task_struct *
 	if (!mm)
 		return;
 
-	sync_mm_rss(mm);
 	/*
 	 * Serialize with any possible pending coredump.
 	 * We must hold mmap_sem around checking core_state
--- x/kernel/taskstats.c
+++ x/kernel/taskstats.c
@@ -630,8 +630,7 @@ void taskstats_exit(struct task_struct *
 	if (!stats)
 		goto err;
 
-	if (tsk->mm)
-		sync_mm_rss(tsk->mm);
+	sync_mm_rss(tsk->mm);
 	fill_stats(tsk, stats);
 
 	/*
--- x/kernel/exit.c
+++ x/kernel/exit.c
@@ -656,7 +656,6 @@ static void exit_mm(struct task_struct *
 	if (!mm)
 		return;
 
-	sync_mm_rss(mm);
 	/*
 	 * Serialize with any possible pending coredump.
 	 * We must hold mmap_sem around checking core_state

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-06-08 12:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120607212114.E4F5AA02F8@akpm.mtv.corp.google.com>
     [not found] ` <CA+55aFxOWR_h1vqRLAd_h5_woXjFBLyBHP--P8F7WsYrciXdmA@mail.gmail.com>
2012-06-08  0:25   ` [patch 12/12] mm: correctly synchronize rss-counters at exit/exec Linus Torvalds
2012-06-08  1:05     ` Markus Trippelsdorf
2012-06-08  1:18       ` Linus Torvalds
2012-06-08 12:18         ` Oleg Nesterov
2012-06-11 10:25           ` Kamezawa Hiroyuki
2012-06-08  1:16     ` Hugh Dickins
2012-06-08  1:19       ` Linus Torvalds
2012-06-08  5:28         ` Hugh Dickins
2012-06-08 10:20       ` Konstantin Khlebnikov
2012-06-08 12:24         ` Oleg Nesterov [this message]
2012-06-08 13:29           ` Konstantin Khlebnikov
2012-06-08 17:01             ` Oleg Nesterov
2012-06-09  9:43               ` [PATCH] " Konstantin Khlebnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120608122459.GB23147@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=khlebnikov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=markus@trippelsdorf.de \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).