[PATCH] hugetlb: clarify hugetlb_instantiation_mutex usage

From: Michal Hocko
Date: Mon Nov 21 2011 - 09:39:45 EST


Let's make it clear that we cannot race with other fault handlers due to
hugetlb (global) mutex.
Also make it clear that we want to keep pte_same checks anayway to have a
transition from the global mutex easier.

Signed-off-by: Michal Hocko <mhocko@xxxxxxx>
---
mm/hugetlb.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index f76c7ea..611cdc8 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2348,6 +2348,9 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma,

/*
* Hugetlb_cow() should be called with page lock of the original hugepage held.
+ * Called with hugetlb_instantiation_mutex held and pte_page locked so we
+ * cannot race with other handlers or page migration.
+ * Keep the pte_same checks anyway to make transition from the mutex easier.
*/
static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
unsigned long address, pte_t *ptep, pte_t pte,
--
1.7.7.1


--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/