The term "freeze" is used in several ways in the kernel, and in mm it has the particular meaning of forcing page refcount temporarily to 0. freeze_page() is just too confusing a name for a function that unmaps a page: rename it unmap_page(), and rename unfreeze_page() remap_page(). Went to change the mention of freeze_page() added later in mm/rmap.c, but found it to be incorrect: ordinary page reclaim reaches there too; but the substance of the comment still seems correct, so edit it down.
Unified · Split
| @@ -2350,7 +2350,7 @@ void vma_adjust_trans_huge(struct vm_area_struct *vma, · 2349 unmodified lines | ||
| 2350 | 2350 | } |
| 2351 | 2351 | } |
| 2352 | 2352 | |
| 2353 | −static void freeze_page(struct page *page) | |
| 2353 | +static void unmap_page(struct page *page) | |
| 2354 | 2354 | { |
| 2355 | 2355 | enum ttu_flags ttu_flags = TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS | |
| 2356 | 2356 | TTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD; |
| @@ -2365,7 +2365,7 @@ static void freeze_page(struct page *page) · 8 unmodified lines | ||
| 2365 | 2365 | VM_BUG_ON_PAGE(!unmap_success, page); |
| 2366 | 2366 | } |
| 2367 | 2367 | |
| 2368 | −static void unfreeze_page(struct page *page) | |
| 2368 | +static void remap_page(struct page *page) | |
| 2369 | 2369 | { |
| 2370 | 2370 | int i; |
| 2371 | 2371 | if (PageTransHuge(page)) { |
| @@ -2483,7 +2483,7 @@ static void __split_huge_page(struct page *page, struct list_head *list, · 111 unmodified lines | ||
| 2483 | 2483 | |
| 2484 | 2484 | spin_unlock_irqrestore(zone_lru_lock(page_zone(head)), flags); |
| 2485 | 2485 | |
| 2486 | − unfreeze_page(head); | |
| 2486 | + remap_page(head); | |
| 2487 | 2487 | |
| 2488 | 2488 | for (i = 0; i < HPAGE_PMD_NR; i++) { |
| 2489 | 2489 | struct page *subpage = head + i; |
| @@ -2664,7 +2664,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) · 174 unmodified lines | ||
| 2664 | 2664 | } |
| 2665 | 2665 | |
| 2666 | 2666 | /* |
| 2667 | − * Racy check if we can split the page, before freeze_page() will | |
| 2667 | + * Racy check if we can split the page, before unmap_page() will | |
| 2668 | 2668 | * split PMDs |
| 2669 | 2669 | */ |
| 2670 | 2670 | if (!can_split_huge_page(head, &extra_pins)) { |
| @@ -2673,7 +2673,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) · 2 unmodified lines | ||
| 2673 | 2673 | } |
| 2674 | 2674 | |
| 2675 | 2675 | mlocked = PageMlocked(page); |
| 2676 | − freeze_page(head); | |
| 2676 | + unmap_page(head); | |
| 2677 | 2677 | VM_BUG_ON_PAGE(compound_mapcount(head), head); |
| 2678 | 2678 | |
| 2679 | 2679 | /* Make sure the page is not on per-CPU pagevec as it takes pin */ |
| @@ -2727,7 +2727,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) · 47 unmodified lines | ||
| 2727 | 2727 | fail: if (mapping) |
| 2728 | 2728 | xa_unlock(&mapping->i_pages); |
| 2729 | 2729 | spin_unlock_irqrestore(zone_lru_lock(page_zone(head)), flags); |
| 2730 | − unfreeze_page(head); | |
| 2730 | + remap_page(head); | |
| 2731 | 2731 | ret = -EBUSY; |
| 2732 | 2732 | } |
| 2733 | 2733 | |
| @@ -1627,16 +1627,9 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, · 1626 unmodified lines | ||
| 1627 | 1627 | address + PAGE_SIZE); |
| 1628 | 1628 | } else { |
| 1629 | 1629 | /* |
| 1630 | − * We should not need to notify here as we reach this | |
| 1631 | − * case only from freeze_page() itself only call from | |
| 1632 | − * split_huge_page_to_list() so everything below must | |
| 1633 | − * be true: | |
| 1634 | − * - page is not anonymous | |
| 1635 | − * - page is locked | |
| 1636 | − * | |
| 1637 | − * So as it is a locked file back page thus it can not | |
| 1638 | − * be remove from the page cache and replace by a new | |
| 1639 | − * page before mmu_notifier_invalidate_range_end so no | |
| 1630 | + * This is a locked file-backed page, thus it cannot | |
| 1631 | + * be removed from the page cache and replaced by a new | |
| 1632 | + * page before mmu_notifier_invalidate_range_end, so no | |
| 1640 | 1633 | * concurrent thread might update its page table to |
| 1641 | 1634 | * point at new page while a device still is using this |
| 1642 | 1635 | * page. |