Re: [PATCH v4 3.0-rc2-tip 7/22] 7: uprobes: mmap and fork hooks.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2011-06-27 at 12:15 +0530, Srikar Dronamraju wrote:

> > > 	mutex_lock(&mapping->i_mmap_mutex);
> > > 	add_to_temp_list(vma, inode, &tmp_list);
> > > 	list_for_each_entry_safe(uprobe, u, &tmp_list, pending_list) {
> > > 		loff_t vaddr;
> > > 
> > > 		list_del(&uprobe->pending_list);
> > > 		if (ret)
> > > 			continue;
> > > 
> > > 		vaddr = vma->vm_start + uprobe->offset;
> > > 		vaddr -= vma->vm_pgoff << PAGE_SHIFT;
> > > 		ret = install_breakpoint(mm, uprobe, vaddr);
> > 
> > Right, so this is the problem, you cannot do allocations under
> > i_mmap_mutex, however I think you can under i_mutex.
> 
> I didnt know that we cannot do allocations under i_mmap_mutex.
> Why is this? 

Because we try to take i_mmap_mutex during reclaim, trying to unmap
pages. So suppose we do an allocation while holding i_mmap_mutex, find
there's no free memory, try and unmap a page in order to free it, and
we're stuck.

> I cant take i_mutex, because we would have already held
> down_write(mmap_sem) here. 

Right. So can we add a lock in the uprobe? All we need is per uprobe
serialization, right?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  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


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]