rmap.c (664b0bae0b87f69bc9deb098f5e0158b9cf18e04) rmap.c (e8b098fc5747a7c871f113c9eb65453cc2d86e6f)
1/*
2 * mm/rmap.c - physical to virtual reverse mappings
3 *
4 * Copyright 2001, Rik van Riel <riel@conectiva.com.br>
5 * Released under the General Public License (GPL).
6 *
7 * Simple, low overhead reverse mapping scheme.
8 * Please try to keep this thing as modular as possible.

--- 1157 unchanged lines hidden (view full) ---

1166 }
1167 __mod_node_page_state(page_pgdat(page), NR_ANON_MAPPED, nr);
1168 __page_set_anon_rmap(page, vma, address, 1);
1169}
1170
1171/**
1172 * page_add_file_rmap - add pte mapping to a file page
1173 * @page: the page to add the mapping to
1/*
2 * mm/rmap.c - physical to virtual reverse mappings
3 *
4 * Copyright 2001, Rik van Riel <riel@conectiva.com.br>
5 * Released under the General Public License (GPL).
6 *
7 * Simple, low overhead reverse mapping scheme.
8 * Please try to keep this thing as modular as possible.

--- 1157 unchanged lines hidden (view full) ---

1166 }
1167 __mod_node_page_state(page_pgdat(page), NR_ANON_MAPPED, nr);
1168 __page_set_anon_rmap(page, vma, address, 1);
1169}
1170
1171/**
1172 * page_add_file_rmap - add pte mapping to a file page
1173 * @page: the page to add the mapping to
1174 * @compound: charge the page as compound or small page
1174 *
1175 * The caller needs to hold the pte lock.
1176 */
1177void page_add_file_rmap(struct page *page, bool compound)
1178{
1179 int i, nr = 1;
1180
1181 VM_BUG_ON_PAGE(compound && !PageTransHuge(page), page);

--- 310 unchanged lines hidden (view full) ---

1492 dec_mm_counter(mm, mm_counter(page));
1493 /* We have to invalidate as we cleared the pte */
1494 mmu_notifier_invalidate_range(mm, address,
1495 address + PAGE_SIZE);
1496 } else if (IS_ENABLED(CONFIG_MIGRATION) &&
1497 (flags & (TTU_MIGRATION|TTU_SPLIT_FREEZE))) {
1498 swp_entry_t entry;
1499 pte_t swp_pte;
1175 *
1176 * The caller needs to hold the pte lock.
1177 */
1178void page_add_file_rmap(struct page *page, bool compound)
1179{
1180 int i, nr = 1;
1181
1182 VM_BUG_ON_PAGE(compound && !PageTransHuge(page), page);

--- 310 unchanged lines hidden (view full) ---

1493 dec_mm_counter(mm, mm_counter(page));
1494 /* We have to invalidate as we cleared the pte */
1495 mmu_notifier_invalidate_range(mm, address,
1496 address + PAGE_SIZE);
1497 } else if (IS_ENABLED(CONFIG_MIGRATION) &&
1498 (flags & (TTU_MIGRATION|TTU_SPLIT_FREEZE))) {
1499 swp_entry_t entry;
1500 pte_t swp_pte;
1501
1502 if (arch_unmap_one(mm, vma, address, pteval) < 0) {
1503 set_pte_at(mm, address, pvmw.pte, pteval);
1504 ret = false;
1505 page_vma_mapped_walk_done(&pvmw);
1506 break;
1507 }
1508
1500 /*
1501 * Store the pfn of the page in a special migration
1502 * pte. do_swap_page() will wait until the migration
1503 * pte is removed and then restart fault handling.
1504 */
1505 entry = make_migration_entry(subpage,
1506 pte_write(pteval));
1507 swp_pte = swp_entry_to_pte(entry);

--- 43 unchanged lines hidden (view full) ---

1551 }
1552
1553 if (swap_duplicate(entry) < 0) {
1554 set_pte_at(mm, address, pvmw.pte, pteval);
1555 ret = false;
1556 page_vma_mapped_walk_done(&pvmw);
1557 break;
1558 }
1509 /*
1510 * Store the pfn of the page in a special migration
1511 * pte. do_swap_page() will wait until the migration
1512 * pte is removed and then restart fault handling.
1513 */
1514 entry = make_migration_entry(subpage,
1515 pte_write(pteval));
1516 swp_pte = swp_entry_to_pte(entry);

--- 43 unchanged lines hidden (view full) ---

1560 }
1561
1562 if (swap_duplicate(entry) < 0) {
1563 set_pte_at(mm, address, pvmw.pte, pteval);
1564 ret = false;
1565 page_vma_mapped_walk_done(&pvmw);
1566 break;
1567 }
1568 if (arch_unmap_one(mm, vma, address, pteval) < 0) {
1569 set_pte_at(mm, address, pvmw.pte, pteval);
1570 ret = false;
1571 page_vma_mapped_walk_done(&pvmw);
1572 break;
1573 }
1559 if (list_empty(&mm->mmlist)) {
1560 spin_lock(&mmlist_lock);
1561 if (list_empty(&mm->mmlist))
1562 list_add(&mm->mmlist, &init_mm.mmlist);
1563 spin_unlock(&mmlist_lock);
1564 }
1565 dec_mm_counter(mm, MM_ANONPAGES);
1566 inc_mm_counter(mm, MM_SWAPENTS);

--- 342 unchanged lines hidden ---
1574 if (list_empty(&mm->mmlist)) {
1575 spin_lock(&mmlist_lock);
1576 if (list_empty(&mm->mmlist))
1577 list_add(&mm->mmlist, &init_mm.mmlist);
1578 spin_unlock(&mmlist_lock);
1579 }
1580 dec_mm_counter(mm, MM_ANONPAGES);
1581 inc_mm_counter(mm, MM_SWAPENTS);

--- 342 unchanged lines hidden ---