diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index a878f009347cd9707e89ca0d3bd9aba280a1d6d9..47a7b96cfe10f07f594adb5ee6316782294e0aa9 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -787,9 +787,10 @@ static int hugetlbfs_fallocate_chunk(pgoff_t start, pgoff_t end, mutex_unlock(&hugetlb_fault_mutex_table[hash]); + set_page_huge_active(page); /* * unlock_page because locked by add_to_page_cache() - * page_put due to reference from alloc_huge_page() + * put_page() due to reference from alloc_huge_page() */ unlock_page(page); put_page(page); diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 4a5cf4c9849642415dfb8c9cdb4fee3bd014fa1e..eefa6d42140d3a775df3664984403d2bf45f3b5a 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -556,6 +556,9 @@ static inline void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr set_huge_pte_at(mm, addr, ptep, pte); } #endif + +void set_page_huge_active(struct page *page); + #else /* CONFIG_HUGETLB_PAGE */ struct hstate {}; #define alloc_huge_page(v, a, r) NULL diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 74007332423b5839a4e854cfa9d742f9b0ca39ff..8dff07b28df43dc3f369cf661d8c33c0953f09c7 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1219,7 +1219,7 @@ bool page_huge_active(struct page *page) } /* never called for tail page */ -static void set_page_huge_active(struct page *page) +void set_page_huge_active(struct page *page) { VM_BUG_ON_PAGE(!PageHeadHuge(page), page); SetPagePrivate(&page[1]);