Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1253411 > unrolled thread

[PATCH] mm/hugetlb: i_mmap_lock_write before unmapping in remove_inode_hugepages

Started byMike Kravetz <mike.kravetz@oracle.com>
First post2015-10-22 03:50 +0200
Last post2015-10-23 15:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm/hugetlb: i_mmap_lock_write before unmapping in remove_inode_hugepages Mike Kravetz <mike.kravetz@oracle.com> - 2015-10-22 03:50 +0200
    Re: [PATCH] mm/hugetlb: i_mmap_lock_write before unmapping in  remove_inode_hugepages Davidlohr Bueso <dave@stgolabs.net> - 2015-10-23 15:50 +0200

#1253411 — [PATCH] mm/hugetlb: i_mmap_lock_write before unmapping in remove_inode_hugepages

FromMike Kravetz <mike.kravetz@oracle.com>
Date2015-10-22 03:50 +0200
Subject[PATCH] mm/hugetlb: i_mmap_lock_write before unmapping in remove_inode_hugepages
Message-ID<qmdaW-486-7@gated-at.bofh.it>
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

--
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/

[toc] | [next] | [standalone]


#1254619 — Re: [PATCH] mm/hugetlb: i_mmap_lock_write before unmapping in remove_inode_hugepages

FromDavidlohr Bueso <dave@stgolabs.net>
Date2015-10-23 15:50 +0200
SubjectRe: [PATCH] mm/hugetlb: i_mmap_lock_write before unmapping in remove_inode_hugepages
Message-ID<qmKTh-32t-33@gated-at.bofh.it>
In reply to#1253411
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>
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web