diff options
| -rw-r--r-- | mm/huge_memory.c | 12 | ||||
| -rw-r--r-- | mm/rmap.c | 13 |
2 files changed, 9 insertions, 16 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 55478ab3c83b..30100fac2341 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
| @@ -2350,7 +2350,7 @@ void vma_adjust_trans_huge(struct vm_area_struct *vma, | |||
| 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 | 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) | |||
| 2365 | VM_BUG_ON_PAGE(!unmap_success, page); | 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 | 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, | |||
| 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) | |||
| 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 | * split PMDs | 2668 | * 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) | |||
| 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) | |||
| 2727 | fail: if (mapping) | 2727 | fail: 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 | ||
| @@ -1627,16 +1627,9 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, | |||
| 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 this | 1630 | * This is a locked file-backed page, thus it cannot |
| 1631 | * case only from freeze_page() itself only call from | 1631 | * be removed from the page cache and replaced by a new |
| 1632 | * split_huge_page_to_list() so everything below must | 1632 | * 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 to | 1633 | * concurrent thread might update its page table to |
| 1641 | * point at new page while a device still is using this | 1634 | * point at new page while a device still is using this |
| 1642 | * page. | 1635 | * page. |
