Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756311Ab2JQItZ (ORCPT ); Wed, 17 Oct 2012 04:49:25 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:60022 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751784Ab2JQItX (ORCPT ); Wed, 17 Oct 2012 04:49:23 -0400 MIME-Version: 1.0 In-Reply-To: <507E4531.1070700@jp.fujitsu.com> References: <20121008150949.GA15130@redhat.com> <20121017040515.GA13505@redhat.com> <507E4531.1070700@jp.fujitsu.com> From: KOSAKI Motohiro Date: Wed, 17 Oct 2012 04:49:02 -0400 Message-ID: Subject: Re: [patch for-3.7] mm, mempolicy: fix printing stack contents in numa_maps To: Kamezawa Hiroyuki Cc: David Rientjes , Dave Jones , Andrew Morton , Linus Torvalds , bhutchings@solarflare.com, Konstantin Khlebnikov , Naoya Horiguchi , Hugh Dickins , linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2365 Lines: 52 On Wed, Oct 17, 2012 at 1:42 AM, Kamezawa Hiroyuki wrote: > (2012/10/17 14:24), David Rientjes wrote: >> >> On Wed, 17 Oct 2012, Dave Jones wrote: >> >>> BUG: sleeping function called from invalid context at kernel/mutex.c:269 >>> in_atomic(): 1, irqs_disabled(): 0, pid: 8558, name: trinity-child2 >>> 3 locks on stack by trinity-child2/8558: >>> #0: held: (&p->lock){+.+.+.}, instance: ffff88010c9a00b0, at: >>> [] seq_lseek+0x3f/0x120 >>> #1: held: (&mm->mmap_sem){++++++}, instance: ffff88013956f7c8, at: >>> [] m_start+0xa7/0x190 >>> #2: held: (&(&p->alloc_lock)->rlock){+.+...}, instance: >>> ffff88011fc64f30, at: [] show_numa_map+0x14f/0x610 >>> Pid: 8558, comm: trinity-child2 Not tainted 3.7.0-rc1+ #32 >>> Call Trace: >>> [] __might_sleep+0x14c/0x200 >>> [] mutex_lock_nested+0x2e/0x50 >>> [] mpol_shared_policy_lookup+0x33/0x90 >>> [] shmem_get_policy+0x33/0x40 >>> [] get_vma_policy+0x3a/0x90 >>> [] show_numa_map+0x163/0x610 >>> [] ? pid_maps_open+0x20/0x20 >>> [] ? pagemap_hugetlb_range+0xf0/0xf0 >>> [] show_pid_numa_map+0x13/0x20 >>> [] traverse+0xf2/0x230 >>> [] seq_lseek+0xab/0x120 >>> [] sys_lseek+0x7b/0xb0 >>> [] tracesys+0xe1/0xe6 >>> >> >> Hmm, looks like we need to change the refcount semantics entirely. We'll >> need to make get_vma_policy() always take a reference and then drop it >> accordingly. This work sif get_vma_policy() can grab a reference while >> holding task_lock() for the task policy fallback case. >> >> Comments on this approach? > > > I think this refcounting is better than using task_lock(). I don't think so. get_vma_policy() is used from fast path. In other words, number of atomic ops is sensible for allocation performance. Instead, I'd like to use spinlock for shared mempolicy instead of mutex. -- 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/