Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755851Ab2FHN3K (ORCPT ); Fri, 8 Jun 2012 09:29:10 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:45492 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752703Ab2FHN3I (ORCPT ); Fri, 8 Jun 2012 09:29:08 -0400 Message-ID: <4FD1FE20.40600@openvz.org> Date: Fri, 08 Jun 2012 17:29:04 +0400 From: Konstantin Khlebnikov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120517 Firefox/10.0.4 Iceape/2.7.4 MIME-Version: 1.0 To: Oleg Nesterov CC: Hugh Dickins , Linus Torvalds , "akpm@linux-foundation.org" , Linux Kernel Mailing List , linux-mm , "kamezawa.hiroyu@jp.fujitsu.com" , "markus@trippelsdorf.de" , "stable@vger.kernel.org" Subject: Re: [patch 12/12] mm: correctly synchronize rss-counters at exit/exec References: <20120607212114.E4F5AA02F8@akpm.mtv.corp.google.com> <4FD1D1F7.2090503@openvz.org> <20120608122459.GB23147@redhat.com> In-Reply-To: <20120608122459.GB23147@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2076 Lines: 69 Oleg Nesterov wrote: > 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. Patch below broken: it removes one hunk from kernel/exit.c twice. And it does not add anything into mm_release(). > > 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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/