History

mm/huge_memory: rename freeze_page() to unmap_page()

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.

Hugh Dickins committed 7 years ago

Commit 906f9cd1 parent 7c0950d2 files · +9 −16Browse files

Unified · Split

2 files
  1. mm/huge_memory.c +6 −6
  2. mm/rmap.c +3 −10
mm/huge_memory.c+6−6
@@ -2350,7 +2350,7 @@ void vma_adjust_trans_huge(struct vm_area_struct *vma, · 2349 unmodified lines
2350 }2350 }
2351}2351}
2352 2352
2353static void freeze_page(struct page *page)2353static void unmap_page(struct page *page)
2354{2354{
2355 enum ttu_flags ttu_flags = TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS |2355 enum ttu_flags ttu_flags = TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS |
2356 TTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD;2356 TTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD;
@@ -2365,7 +2365,7 @@ static void freeze_page(struct page *page) · 8 unmodified lines
2365 VM_BUG_ON_PAGE(!unmap_success, page);2365 VM_BUG_ON_PAGE(!unmap_success, page);
2366}2366}
2367 2367
2368static void unfreeze_page(struct page *page)2368static void remap_page(struct page *page)
2369{2369{
2370 int i;2370 int i;
2371 if (PageTransHuge(page)) {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 spin_unlock_irqrestore(zone_lru_lock(page_zone(head)), flags);2484 spin_unlock_irqrestore(zone_lru_lock(page_zone(head)), flags);
2485 2485
2486 unfreeze_page(head);2486 remap_page(head);
2487 2487
2488 for (i = 0; i < HPAGE_PMD_NR; i++) {2488 for (i = 0; i < HPAGE_PMD_NR; i++) {
2489 struct page *subpage = head + i;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() will2667 * Racy check if we can split the page, before unmap_page() will
2668 * split PMDs2668 * split PMDs
2669 */2669 */
2670 if (!can_split_huge_page(head, &extra_pins)) {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 mlocked = PageMlocked(page);2675 mlocked = PageMlocked(page);
2676 freeze_page(head);2676 unmap_page(head);
2677 VM_BUG_ON_PAGE(compound_mapcount(head), head);2677 VM_BUG_ON_PAGE(compound_mapcount(head), head);
2678 2678
2679 /* Make sure the page is not on per-CPU pagevec as it takes pin */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
2727fail: if (mapping)2727fail: if (mapping)
2728 xa_unlock(&mapping->i_pages);2728 xa_unlock(&mapping->i_pages);
2729 spin_unlock_irqrestore(zone_lru_lock(page_zone(head)), flags);2729 spin_unlock_irqrestore(zone_lru_lock(page_zone(head)), flags);
2730 unfreeze_page(head);2730 remap_page(head);
2731 ret = -EBUSY;2731 ret = -EBUSY;
2732 }2732 }
2733 2733
mm/rmap.c+3−10
@@ -1627,16 +1627,9 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, · 1626 unmodified lines
1627 address + PAGE_SIZE);1627 address + PAGE_SIZE);
1628 } else {1628 } else {
1629 /*1629 /*
1630 * We should not need to notify here as we reach this1630 * This is a locked file-backed page, thus it cannot
1631 * case only from freeze_page() itself only call from1631 * be removed from the page cache and replaced by a new
1632 * split_huge_page_to_list() so everything below must1632 * page before mmu_notifier_invalidate_range_end, so no
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
1640 * concurrent thread might update its page table to1633 * concurrent thread might update its page table to
1641 * point at new page while a device still is using this1634 * point at new page while a device still is using this
1642 * page.1635 * page.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t