Thread (59 messages) 59 messages, 10 authors, 2012-11-21

Re: [patch for-3.7] mm, mempolicy: fix printing stack contents in numa_maps

From: KOSAKI Motohiro <hidden>
Date: 2012-10-17 08:49:25
Also in: lkml

On Wed, Oct 17, 2012 at 1:42 AM, Kamezawa Hiroyuki
[off-list ref] wrote:
(2012/10/17 14:24), David Rientjes wrote:
quoted
On Wed, 17 Oct 2012, Dave Jones wrote:
quoted
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:
[<ffffffff8120cd1f>] seq_lseek+0x3f/0x120
  #1: held:     (&mm->mmap_sem){++++++}, instance: ffff88013956f7c8, at:
[<ffffffff81254437>] m_start+0xa7/0x190
  #2: held:     (&(&p->alloc_lock)->rlock){+.+...}, instance:
ffff88011fc64f30, at: [<ffffffff81254f8f>] show_numa_map+0x14f/0x610
Pid: 8558, comm: trinity-child2 Not tainted 3.7.0-rc1+ #32
Call Trace:
  [<ffffffff810ae4ec>] __might_sleep+0x14c/0x200
  [<ffffffff816bdf4e>] mutex_lock_nested+0x2e/0x50
  [<ffffffff811c43a3>] mpol_shared_policy_lookup+0x33/0x90
  [<ffffffff8118d5c3>] shmem_get_policy+0x33/0x40
  [<ffffffff811c31fa>] get_vma_policy+0x3a/0x90
  [<ffffffff81254fa3>] show_numa_map+0x163/0x610
  [<ffffffff81255b10>] ? pid_maps_open+0x20/0x20
  [<ffffffff81255980>] ? pagemap_hugetlb_range+0xf0/0xf0
  [<ffffffff81255483>] show_pid_numa_map+0x13/0x20
  [<ffffffff8120c902>] traverse+0xf2/0x230
  [<ffffffff8120cd8b>] seq_lseek+0xab/0x120
  [<ffffffff811e6c0b>] sys_lseek+0x7b/0xb0
  [<ffffffff816ca088>] 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, 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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help