Lines Matching refs:page

25  * the head of the inactive list and page reclaim scans pages from the
67 * Approximating inactive page access frequency - Observations:
69 * 1. When a page is accessed for the first time, it is added to the
70 * head of the inactive list, slides every existing inactive page
71 * towards the tail by one slot, and pushes the current tail page
74 * 2. When a page is accessed for the second time, it is promoted to
77 * more recently than the activated page towards the tail of the
86 * 2. Moving one inactive page N page slots towards the tail of the
87 * list requires at least N inactive page accesses.
91 * 1. When a page is finally evicted from memory, the number of
92 * inactive pages accessed while the page was in cache is at least
93 * the number of page slots on the inactive list.
96 * at the time of a page's eviction, and comparing it to another
97 * reading (R) at the time the page faults back into memory tells
98 * the minimum number of accesses while the page was not cached.
101 * Because the first access of the page was the fault and the second
104 * of this page:
108 * And knowing the minimum access distance of a page, we can easily
109 * tell if the page would be able to stay in cache assuming all page
120 * had (R - E) more page slots, the page would not have been evicted
133 * least (R - E) active pages, the refaulting page is activated
135 * used less frequently than the refaulting page - or even not used at
155 * space allocated to the page cache.
164 * identify the node) is stored in the now empty page cache
165 * slot of the evicted page. This is called a shadow entry.
168 * refault distance will immediately activate the refaulting page.
233 * cgroups; and every page has an LRU position not just in the
246 * workingset_eviction - note the eviction of a page from memory
248 * @page: the page being evicted
250 * Returns a shadow entry to be stored in @page->mapping->i_pages in place
251 * of the evicted @page so that a later refault can be detected.
253 void *workingset_eviction(struct page *page, struct mem_cgroup *target_memcg)
255 struct pglist_data *pgdat = page_pgdat(page);
260 /* Page is fully exclusive and pins page->mem_cgroup */
261 VM_BUG_ON_PAGE(PageLRU(page), page);
262 VM_BUG_ON_PAGE(page_count(page), page);
263 VM_BUG_ON_PAGE(!PageLocked(page), page);
267 if (!is_prot_page(page) && page_is_file_lru(page)) {
269 workingset_age_nonresident(lruvec, thp_nr_pages(page));
271 workingset_age_nonresident(lruvec, thp_nr_pages(page));
274 workingset_age_nonresident(lruvec, thp_nr_pages(page));
279 return pack_shadow(memcgid, pgdat, eviction, PageWorkingset(page));
283 * workingset_refault - evaluate the refault of a previously evicted page
284 * @page: the freshly allocated replacement page
285 * @shadow: shadow entry of the evicted page
288 * evicted page in the context of the node and the memcg whose memory
291 void workingset_refault(struct page *page, void *shadow)
293 bool file = page_is_file_lru(page);
311 * have been deleted since the page's eviction.
314 * for a new cgroup that refaults a shared page. This is
358 * The activation decision for this page is made at the level
360 * during page reclaim is being determined.
362 * However, the cgroup that will own the page is the one that
365 memcg = page_memcg(page);
368 if (!is_prot_page(page) && file)
411 SetPageActive(page);
413 if (!is_prot_page(page) && file) {
415 thp_nr_pages(page));
418 workingset_age_nonresident(lruvec, thp_nr_pages(page));
422 workingset_age_nonresident(lruvec, thp_nr_pages(page));
428 SetPageWorkingset(page);
430 spin_lock_irq(&page_pgdat(page)->lru_lock);
431 lru_note_cost_page(page);
432 spin_unlock_irq(&page_pgdat(page)->lru_lock);
434 if (!is_prot_page(page) && file)
447 * workingset_activation - note a page activation
448 * @page: page that is being activated
450 void workingset_activation(struct page *page)
463 memcg = page_memcg_rcu(page);
466 lruvec = mem_cgroup_page_lruvec(page, page_pgdat(page));
468 if (!is_prot_page(page) && page_is_file_lru(page)) {
469 lruvec = node_lruvec(page_pgdat(page));
470 workingset_age_nonresident(lruvec, thp_nr_pages(page));
472 workingset_age_nonresident(lruvec, thp_nr_pages(page));
475 workingset_age_nonresident(lruvec, thp_nr_pages(page));
536 * overall page cache as memory grows, with only a tiny
545 * On 64-bit with 7 xa_nodes per page and 64 slots
592 * lru_lock. Because the page cache tree is emptied before