Re: [PATCH v2 1/3] mm/hugetlb: take refcount under page table lock in follow_huge_pmd()

From: Naoya Horiguchi
Date: Mon Aug 04 2014 - 11:29:30 EST


On Fri, Aug 01, 2014 at 02:53:58PM -0700, Andrew Morton wrote:
...
> > --- mmotm-2014-07-22-15-58.orig/mm/hugetlb.c
> > +++ mmotm-2014-07-22-15-58/mm/hugetlb.c
> > @@ -3687,6 +3687,33 @@ follow_huge_pud(struct mm_struct *mm, unsigned long address,
> >
> > #endif /* CONFIG_ARCH_WANT_GENERAL_HUGETLB */
> >
> > +struct page *follow_huge_pmd_lock(struct vm_area_struct *vma,
> > + unsigned long address, pmd_t *pmd, int flags)
>
> Some documentation here wouldn't hurt. Why it exists, what it does.
> And especially: any preconditions to calling it (ie: locking).

Sorry, I missed this comment.
How about this?

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 1da7ca2e2a02..923465c0b47f 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3693,6 +3693,14 @@ follow_huge_pud(struct mm_struct *mm, unsigned long address,

#endif /* CONFIG_ARCH_WANT_GENERAL_HUGETLB */

+/*
+ * This function calls the architecture dependent variant follow_huge_pmd()
+ * with holding page table lock depending on FOLL_GET.
+ * Whether hugepage migration is supported or not, follow() can be called
+ * with FOLL_GET from do_move_page_to_node_array(), so we need do this in
+ * common code.
+ * Should be called under read mmap_sem.
+ */
struct page *follow_huge_pmd_lock(struct vm_area_struct *vma,
unsigned long address, pmd_t *pmd, int flags)
{
--
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/