linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/hugetlb: i_mmap_lock_write before unmapping in remove_inode_hugepages
@ 2015-10-22  1:42 Mike Kravetz
  2015-10-23 13:45 ` Davidlohr Bueso
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Kravetz @ 2015-10-22  1:42 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Dave Hansen, Naoya Horiguchi, Hugh Dickins, Davidlohr Bueso,
	Andrew Morton, Mike Kravetz

Code was added to remove_inode_hugepages that will unmap a page if
it is mapped.  i_mmap_lock_write() must be taken during the call
to hugetlb_vmdelete_list().  This is to prevent mappings(vmas) from
being added or deleted while the list of vmas is being examined.

Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
---
 fs/hugetlbfs/inode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index f25b72f..0f3999d 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -428,9 +428,11 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
 			 * until we finish removing the page.
 			 */
 			if (page_mapped(page)) {
+				i_mmap_lock_write(mapping);
 				hugetlb_vmdelete_list(&mapping->i_mmap,
 					next * pages_per_huge_page(h),
 					(next + 1) * pages_per_huge_page(h));
+				i_mmap_unlock_write(mapping);
 			}
 
 			lock_page(page);
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/hugetlb: i_mmap_lock_write before unmapping in remove_inode_hugepages
  2015-10-22  1:42 [PATCH] mm/hugetlb: i_mmap_lock_write before unmapping in remove_inode_hugepages Mike Kravetz
@ 2015-10-23 13:45 ` Davidlohr Bueso
  0 siblings, 0 replies; 2+ messages in thread
From: Davidlohr Bueso @ 2015-10-23 13:45 UTC (permalink / raw)
  To: Mike Kravetz
  Cc: linux-mm, linux-kernel, Dave Hansen, Naoya Horiguchi,
	Hugh Dickins, Andrew Morton

On Wed, 21 Oct 2015, Mike Kravetz wrote:

>Code was added to remove_inode_hugepages that will unmap a page if
>it is mapped.  i_mmap_lock_write() must be taken during the call
>to hugetlb_vmdelete_list().  This is to prevent mappings(vmas) from
>being added or deleted while the list of vmas is being examined.
                                   ^^^^ interval-tree.
>
>Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>

Reviewed-by: Davidlohr Bueso <dbueso@suse.de>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-23 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22  1:42 [PATCH] mm/hugetlb: i_mmap_lock_write before unmapping in remove_inode_hugepages Mike Kravetz
2015-10-23 13:45 ` Davidlohr Bueso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).