linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Hiroyuki Kamezawa <kamezawa.hiroyuki@gmail.com>,
	Ying Han <yinghan@google.com>, Dave Jones <davej@redhat.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] [BUGFIX] update mm->owner even if no next owner.
Date: Sat, 11 Jun 2011 20:04:15 +0200	[thread overview]
Message-ID: <20110611180415.GB31154@cmpxchg.org> (raw)
In-Reply-To: <20110611163943.GA3238@redhat.com>

On Sat, Jun 11, 2011 at 06:39:43PM +0200, Andrea Arcangeli wrote:
> On Sat, Jun 11, 2011 at 09:04:14AM -0700, Hugh Dickins wrote:
> > I had another go at reproducing it, 2 hours that time, then a try with
> > 692e0b35427a reverted: it ran overnight for 9 hours when I stopped it.
> > 
> > Andrea, please would you ask Linus to revert that commit before -rc3?
> > Or is there something else you'd like us to try instead?  I admit that
> > I've not actually taken the time to think through exactly how it goes
> > wrong, but it does look dangerous.
> 
> Here I was asked if the mem_cgroup_newpage_charge need the mmap_sem at
> all. And if not why not to release the mmap_sem early.
> 
> https://lkml.org/lkml/2011/3/14/276
> 
> So I didn't see why mmap_sem was needed, I also asked confirmation and
> who answered agreed it was safe without mmap_sem even if it's the only
> place doing that. Maybe that assumption was wrong and we need
> mmap_sem after all if this commit is causing problems.
> 
> Or did you find something wrong in the actual patch?
> 
> Do I understand right that the bug just that we must run
> alloc_hugepage_vma+mem_cgroup_newpage_charge within the same critical
> section protected by the mmap_sem read mode? Do we know why?

The problem is that mm->owner points to a stale task structure if the
last possible owner is exiting.  The mmap_sem just prevented the task
from actually exiting through write-acquiring the mmap_sem in
khugepaged_exit().

I think enforcing lifetime of an object through locks is not the
nicest thing to do, so I stand by what I wrote in the mail you linked
to above :) and agree with Kame that mm->owner should just not point
to a stale task struct.  The memcg code can handle it going NULL.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-06-11 18:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110609212956.GA2319@redhat.com>
2011-06-09 22:47 ` 3.0rc2 oops in mem_cgroup_from_task Ying Han
2011-06-09 23:42   ` Ying Han
2011-06-10  0:13     ` KAMEZAWA Hiroyuki
2011-06-10  1:30       ` Hugh Dickins
2011-06-10  2:33         ` KAMEZAWA Hiroyuki
2011-06-10  3:19           ` KAMEZAWA Hiroyuki
2011-06-10  3:55             ` KAMEZAWA Hiroyuki
2011-06-10  4:30               ` [PATCH] [BUGFIX] update mm->owner even if no next owner KAMEZAWA Hiroyuki
2011-06-10  5:06                 ` Daisuke Nishimura
2011-06-10  5:21                 ` Xiaotian Feng
2011-06-10  5:22                   ` KAMEZAWA Hiroyuki
2011-06-10 21:49                 ` Hugh Dickins
2011-06-10 23:54                   ` Johannes Weiner
2011-06-11 17:51                     ` Johannes Weiner
2011-06-11 18:44                       ` Andrea Arcangeli
2011-06-11 23:04                         ` Hiroyuki Kamezawa
2011-06-13  1:41                       ` Hugh Dickins
2011-06-13  1:54                         ` KAMEZAWA Hiroyuki
2011-06-13 14:03                           ` Hugh Dickins
2011-06-11  0:46                   ` Hiroyuki Kamezawa
2011-06-11 16:04                     ` Hugh Dickins
2011-06-11 16:39                       ` Andrea Arcangeli
2011-06-11 18:04                         ` Johannes Weiner [this message]
2011-06-11  8:19 ` 3.0rc2 oops in mem_cgroup_from_task Michal Hocko
2011-06-11 15:46   ` Hugh Dickins
2011-06-12  9:09     ` Michal Hocko

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=20110611180415.GB31154@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=hughd@google.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kamezawa.hiroyuki@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oleg@redhat.com \
    --cc=yinghan@google.com \
    /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