path: root/fs/hugetlbfs
diff options
authorMike Kravetz <>2021-02-24 12:08:56 -0800
committerLinus Torvalds <>2021-02-24 13:38:34 -0800
commit8f251a3d5ce3bdea73bd045ed35db64f32e0d0d9 (patch)
treeba7424cb761d8e03cfa1ebc047a450a4619004fc /fs/hugetlbfs
parentd6995da311221a05c8aef3bda2629e5cb14c7302 (diff)
hugetlb: convert page_huge_active() HPageMigratable flag
Use the new hugetlb page specific flag HPageMigratable to replace the page_huge_active interfaces. By it's name, page_huge_active implied that a huge page was on the active list. However, that is not really what code checking the flag wanted to know. It really wanted to determine if the huge page could be migrated. This happens when the page is actually added to the page cache and/or task page table. This is the reasoning behind the name change. The VM_BUG_ON_PAGE() calls in the *_huge_active() interfaces are not really necessary as we KNOW the page is a hugetlb page. Therefore, they are removed. The routine page_huge_active checked for PageHeadHuge before testing the active bit. This is unnecessary in the case where we hold a reference or lock and know it is a hugetlb head page. page_huge_active is also called without holding a reference or lock (scan_movable_pages), and can race with code freeing the page. The extra check in page_huge_active shortened the race window, but did not prevent the race. Offline code calling scan_movable_pages already deals with these races, so removing the check is acceptable. Add comment to racy code. [ remove set_page_huge_active() declaration from include/linux/hugetlb.h] Link: Link: Signed-off-by: Mike Kravetz <> Reviewed-by: Oscar Salvador <> Reviewed-by: Muchun Song <> Reviewed-by: Miaohe Lin <> Acked-by: Michal Hocko <> Cc: David Hildenbrand <> Cc: Matthew Wilcox <> Cc: Naoya Horiguchi <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'fs/hugetlbfs')
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 907f6405e805..5a8ed6bd4f87 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -735,7 +735,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
- set_page_huge_active(page);
+ SetHPageMigratable(page);
* unlock_page because locked by add_to_page_cache()
* put_page() due to reference from alloc_huge_page()