From: Michal Hocko Date: Wed, 30 Nov 2011 04:11:27 +0000 (+1100) Subject: hugetlb: clarify hugetlb_instantiation_mutex usage X-Git-Tag: next-20111130~3^2~120 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4e94dae5b3bddf91227a38c2b75b158f3746a3c3;p=karo-tx-linux.git hugetlb: clarify hugetlb_instantiation_mutex usage 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 Cc: Hillf Danton Cc: Andrea Arcangeli Cc: Johannes Weiner Signed-off-by: Andrew Morton --- diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 35ad7a01ca1d..f34d153ee1ed 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2349,6 +2349,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,