Lines Matching refs:page

99 	struct page *page;  in __try_to_reclaim_swap()  local
102 page = find_get_page(swap_address_space(entry), entry.val); in __try_to_reclaim_swap()
103 if (!page) in __try_to_reclaim_swap()
112 if (trylock_page(page)) { in __try_to_reclaim_swap()
113 ret = try_to_free_swap(page); in __try_to_reclaim_swap()
114 unlock_page(page); in __try_to_reclaim_swap()
116 page_cache_release(page); in __try_to_reclaim_swap()
862 int page_swapcount(struct page *page) in page_swapcount() argument
868 entry.val = page_private(page); in page_swapcount()
885 struct page *page; in swp_swapcount() local
901 page = vmalloc_to_page(p->swap_map + offset); in swp_swapcount()
903 VM_BUG_ON(page_private(page) != SWP_CONTINUED); in swp_swapcount()
906 page = list_entry(page->lru.next, struct page, lru); in swp_swapcount()
907 map = kmap_atomic(page); in swp_swapcount()
925 int reuse_swap_page(struct page *page) in reuse_swap_page() argument
929 VM_BUG_ON_PAGE(!PageLocked(page), page); in reuse_swap_page()
930 if (unlikely(PageKsm(page))) in reuse_swap_page()
932 count = page_mapcount(page); in reuse_swap_page()
933 if (count <= 1 && PageSwapCache(page)) { in reuse_swap_page()
934 count += page_swapcount(page); in reuse_swap_page()
935 if (count == 1 && !PageWriteback(page)) { in reuse_swap_page()
936 delete_from_swap_cache(page); in reuse_swap_page()
937 SetPageDirty(page); in reuse_swap_page()
947 int try_to_free_swap(struct page *page) in try_to_free_swap() argument
949 VM_BUG_ON_PAGE(!PageLocked(page), page); in try_to_free_swap()
951 if (!PageSwapCache(page)) in try_to_free_swap()
953 if (PageWriteback(page)) in try_to_free_swap()
955 if (page_swapcount(page)) in try_to_free_swap()
976 delete_from_swap_cache(page); in try_to_free_swap()
977 SetPageDirty(page); in try_to_free_swap()
988 struct page *page = NULL; in free_swap_and_cache() local
996 page = find_get_page(swap_address_space(entry), in free_swap_and_cache()
998 if (page && !trylock_page(page)) { in free_swap_and_cache()
999 page_cache_release(page); in free_swap_and_cache()
1000 page = NULL; in free_swap_and_cache()
1005 if (page) { in free_swap_and_cache()
1010 if (PageSwapCache(page) && !PageWriteback(page) && in free_swap_and_cache()
1011 (!page_mapped(page) || vm_swap_full())) { in free_swap_and_cache()
1012 delete_from_swap_cache(page); in free_swap_and_cache()
1013 SetPageDirty(page); in free_swap_and_cache()
1015 unlock_page(page); in free_swap_and_cache()
1016 page_cache_release(page); in free_swap_and_cache()
1135 unsigned long addr, swp_entry_t entry, struct page *page) in unuse_pte() argument
1137 struct page *swapcache; in unuse_pte()
1143 swapcache = page; in unuse_pte()
1144 page = ksm_might_need_to_copy(page, vma, addr); in unuse_pte()
1145 if (unlikely(!page)) in unuse_pte()
1148 if (mem_cgroup_try_charge(page, vma->vm_mm, GFP_KERNEL, &memcg)) { in unuse_pte()
1155 mem_cgroup_cancel_charge(page, memcg); in unuse_pte()
1162 get_page(page); in unuse_pte()
1164 pte_mkold(mk_pte(page, vma->vm_page_prot))); in unuse_pte()
1165 if (page == swapcache) { in unuse_pte()
1166 page_add_anon_rmap(page, vma, addr); in unuse_pte()
1167 mem_cgroup_commit_charge(page, memcg, true); in unuse_pte()
1169 page_add_new_anon_rmap(page, vma, addr); in unuse_pte()
1170 mem_cgroup_commit_charge(page, memcg, false); in unuse_pte()
1171 lru_cache_add_active_or_unevictable(page, vma); in unuse_pte()
1178 activate_page(page); in unuse_pte()
1182 if (page != swapcache) { in unuse_pte()
1183 unlock_page(page); in unuse_pte()
1184 put_page(page); in unuse_pte()
1191 swp_entry_t entry, struct page *page) in unuse_pte_range() argument
1214 ret = unuse_pte(vma, pmd, addr, entry, page); in unuse_pte_range()
1227 swp_entry_t entry, struct page *page) in unuse_pmd_range() argument
1238 ret = unuse_pte_range(vma, pmd, addr, next, entry, page); in unuse_pmd_range()
1247 swp_entry_t entry, struct page *page) in unuse_pud_range() argument
1258 ret = unuse_pmd_range(vma, pud, addr, next, entry, page); in unuse_pud_range()
1266 swp_entry_t entry, struct page *page) in unuse_vma() argument
1272 if (page_anon_vma(page)) { in unuse_vma()
1273 addr = page_address_in_vma(page, vma); in unuse_vma()
1288 ret = unuse_pud_range(vma, pgd, addr, next, entry, page); in unuse_vma()
1296 swp_entry_t entry, struct page *page) in unuse_mm() argument
1306 activate_page(page); in unuse_mm()
1307 unlock_page(page); in unuse_mm()
1309 lock_page(page); in unuse_mm()
1312 if (vma->anon_vma && (ret = unuse_vma(vma, entry, page))) in unuse_mm()
1383 struct page *page; in try_to_unuse() local
1423 page = read_swap_cache_async(entry, in try_to_unuse()
1425 if (!page) { in try_to_unuse()
1463 wait_on_page_locked(page); in try_to_unuse()
1464 wait_on_page_writeback(page); in try_to_unuse()
1465 lock_page(page); in try_to_unuse()
1466 wait_on_page_writeback(page); in try_to_unuse()
1473 retval = shmem_unuse(entry, page); in try_to_unuse()
1480 retval = unuse_mm(start_mm, entry, page); in try_to_unuse()
1509 retval = unuse_mm(mm, entry, page); in try_to_unuse()
1525 unlock_page(page); in try_to_unuse()
1526 page_cache_release(page); in try_to_unuse()
1550 PageDirty(page) && PageSwapCache(page)) { in try_to_unuse()
1555 swap_writepage(page, &wbc); in try_to_unuse()
1556 lock_page(page); in try_to_unuse()
1557 wait_on_page_writeback(page); in try_to_unuse()
1567 if (PageSwapCache(page) && in try_to_unuse()
1568 likely(page_private(page) == entry.val)) in try_to_unuse()
1569 delete_from_swap_cache(page); in try_to_unuse()
1576 SetPageDirty(page); in try_to_unuse()
1577 unlock_page(page); in try_to_unuse()
1578 page_cache_release(page); in try_to_unuse()
1652 sector_t map_swap_page(struct page *page, struct block_device **bdev) in map_swap_page() argument
1655 entry.val = page_private(page); in map_swap_page()
2401 struct page *page = NULL; in SYSCALL_DEFINE2() local
2445 page = read_mapping_page(mapping, 0, swap_file); in SYSCALL_DEFINE2()
2446 if (IS_ERR(page)) { in SYSCALL_DEFINE2()
2447 error = PTR_ERR(page); in SYSCALL_DEFINE2()
2450 swap_header = kmap(page); in SYSCALL_DEFINE2()
2584 if (page && !IS_ERR(page)) { in SYSCALL_DEFINE2()
2585 kunmap(page); in SYSCALL_DEFINE2()
2586 page_cache_release(page); in SYSCALL_DEFINE2()
2732 struct swap_info_struct *page_swap_info(struct page *page) in page_swap_info() argument
2734 swp_entry_t swap = { .val = page_private(page) }; in page_swap_info()
2735 BUG_ON(!PageSwapCache(page)); in page_swap_info()
2742 struct address_space *__page_file_mapping(struct page *page) in __page_file_mapping() argument
2744 VM_BUG_ON_PAGE(!PageSwapCache(page), page); in __page_file_mapping()
2745 return page_swap_info(page)->swap_file->f_mapping; in __page_file_mapping()
2749 pgoff_t __page_file_index(struct page *page) in __page_file_index() argument
2751 swp_entry_t swap = { .val = page_private(page) }; in __page_file_index()
2752 VM_BUG_ON_PAGE(!PageSwapCache(page), page); in __page_file_index()
2775 struct page *head; in add_swap_count_continuation()
2776 struct page *page; in add_swap_count_continuation() local
2777 struct page *list_page; in add_swap_count_continuation()
2785 page = alloc_page(gfp_mask | __GFP_HIGHMEM); in add_swap_count_continuation()
2809 if (!page) { in add_swap_count_continuation()
2855 list_add_tail(&page->lru, &head->lru); in add_swap_count_continuation()
2856 page = NULL; /* now it's attached, don't free it */ in add_swap_count_continuation()
2860 if (page) in add_swap_count_continuation()
2861 __free_page(page); in add_swap_count_continuation()
2876 struct page *head; in swap_count_continued()
2877 struct page *page; in swap_count_continued() local
2887 page = list_entry(head->lru.next, struct page, lru); in swap_count_continued()
2888 map = kmap_atomic(page) + offset; in swap_count_continued()
2899 page = list_entry(page->lru.next, struct page, lru); in swap_count_continued()
2900 BUG_ON(page == head); in swap_count_continued()
2901 map = kmap_atomic(page) + offset; in swap_count_continued()
2905 page = list_entry(page->lru.next, struct page, lru); in swap_count_continued()
2906 if (page == head) in swap_count_continued()
2908 map = kmap_atomic(page) + offset; in swap_count_continued()
2913 page = list_entry(page->lru.prev, struct page, lru); in swap_count_continued()
2914 while (page != head) { in swap_count_continued()
2915 map = kmap_atomic(page) + offset; in swap_count_continued()
2918 page = list_entry(page->lru.prev, struct page, lru); in swap_count_continued()
2929 page = list_entry(page->lru.next, struct page, lru); in swap_count_continued()
2930 BUG_ON(page == head); in swap_count_continued()
2931 map = kmap_atomic(page) + offset; in swap_count_continued()
2938 page = list_entry(page->lru.prev, struct page, lru); in swap_count_continued()
2939 while (page != head) { in swap_count_continued()
2940 map = kmap_atomic(page) + offset; in swap_count_continued()
2944 page = list_entry(page->lru.prev, struct page, lru); in swap_count_continued()
2959 struct page *head; in free_swap_count_continuations()
2964 struct page *page; in free_swap_count_continuations() local
2965 page = list_entry(this, struct page, lru); in free_swap_count_continuations()
2967 __free_page(page); in free_swap_count_continuations()