Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756043Ab2JQBtG (ORCPT ); Tue, 16 Oct 2012 21:49:06 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:56180 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755923Ab2JQBtE (ORCPT ); Tue, 16 Oct 2012 21:49:04 -0400 Date: Tue, 16 Oct 2012 18:49:00 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com 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 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> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1332 Lines: 28 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 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/