From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx194.postini.com [74.125.245.194]) by kanga.kvack.org (Postfix) with SMTP id 621126B002B for ; Tue, 16 Oct 2012 21:49:04 -0400 (EDT) Received: by mail-pb0-f41.google.com with SMTP id rq2so7430802pbb.14 for ; Tue, 16 Oct 2012 18:49:03 -0700 (PDT) Date: Tue, 16 Oct 2012 18:49:00 -0700 (PDT) From: David Rientjes Subject: Re: [patch for-3.7] mm, mempolicy: fix printing stack contents in numa_maps In-Reply-To: Message-ID: References: <20121008150949.GA15130@redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: KOSAKI Motohiro Cc: Andrew Morton , Linus Torvalds , Dave Jones , bhutchings@solarflare.com, Konstantin Khlebnikov , Naoya Horiguchi , Hugh Dickins , KAMEZAWA Hiroyuki , linux-kernel@vger.kernel.org, linux-mm@kvack.org On Tue, 16 Oct 2012, KOSAKI Motohiro wrote: > > diff --git a/mm/mempolicy.c b/mm/mempolicy.c > > index 0b78fb9..d04a8a5 100644 > > --- a/mm/mempolicy.c > > +++ b/mm/mempolicy.c > > @@ -1536,9 +1536,8 @@ asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len, > > * > > * Returns effective policy for a VMA at specified address. > > * Falls back to @task or system default policy, as necessary. > > - * Current or other task's task mempolicy and non-shared vma policies > > - * are protected by the task's mmap_sem, which must be held for read by > > - * the caller. > > + * Current or other task's task mempolicy and non-shared vma policies must be > > + * protected by task_lock(task) by the caller. > > This is not correct. mmap_sem is needed for protecting vma. task_lock() > is needed to close vs exit race only when task != current. In other word, > caller must held both mmap_sem and task_lock if task != current. > The comment is specifically addressing non-shared vma policies, you do not need to hold mmap_sem to access another thread's mempolicy. -- 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: email@kvack.org