Lines Matching defs:folio

232 static void *lru_gen_eviction(struct folio *folio)
239 int type = folio_is_file_lru(folio);
240 int delta = folio_nr_pages(folio);
241 int refs = folio_lru_refs(folio);
243 struct mem_cgroup *memcg = folio_memcg(folio);
244 struct pglist_data *pgdat = folio_pgdat(folio);
260 * Tests if the shadow entry is for a folio that was recently evicted.
280 static void lru_gen_refault(struct folio *folio, void *shadow)
288 int type = folio_is_file_lru(folio);
289 int delta = folio_nr_pages(folio);
294 if (lruvec != folio_lruvec(folio))
320 set_mask_bits(&folio->flags, 0, LRU_REFS_MASK | BIT(PG_workingset));
329 static void *lru_gen_eviction(struct folio *folio)
340 static void lru_gen_refault(struct folio *folio, void *shadow)
375 * workingset_eviction - note the eviction of a folio from memory
377 * @folio: the folio being evicted
379 * Return: a shadow entry to be stored in @folio->mapping->i_pages in place
380 * of the evicted @folio so that a later refault can be detected.
382 void *workingset_eviction(struct folio *folio, struct mem_cgroup *target_memcg)
384 struct pglist_data *pgdat = folio_pgdat(folio);
389 /* Folio is fully exclusive and pins folio's memory cgroup pointer */
390 VM_BUG_ON_FOLIO(folio_test_lru(folio), folio);
391 VM_BUG_ON_FOLIO(folio_ref_count(folio), folio);
392 VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
395 return lru_gen_eviction(folio);
402 workingset_age_nonresident(lruvec, folio_nr_pages(folio));
404 folio_test_workingset(folio));
408 * workingset_test_recent - tests if the shadow entry is for a folio that was
412 * @file: whether the corresponding folio is from the file lru.
416 * Return: true if the shadow is for a recently evicted folio; false otherwise.
445 * have been deleted since the folio's eviction.
448 * for a new cgroup that refaults a shared folio. This is
522 * workingset_refault - Evaluate the refault of a previously evicted folio.
523 * @folio: The freshly allocated replacement folio.
524 * @shadow: Shadow entry of the evicted folio.
527 * evicted folio in the context of the node and the memcg whose memory
530 void workingset_refault(struct folio *folio, void *shadow)
532 bool file = folio_is_file_lru(folio);
540 lru_gen_refault(folio, shadow);
545 * The activation decision for this folio is made at the level
547 * during folio reclaim is being determined.
549 * However, the cgroup that will own the folio is the one that
550 * is actually experiencing the refault event. Make sure the folio is
553 VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
554 nr = folio_nr_pages(folio);
555 memcg = folio_memcg(folio);
556 pgdat = folio_pgdat(folio);
564 folio_set_active(folio);
570 folio_set_workingset(folio);
575 lru_note_cost_refault(folio);
582 * @folio: Folio that is being activated.
584 void workingset_activation(struct folio *folio)
596 memcg = folio_memcg_rcu(folio);
599 workingset_age_nonresident(folio_lruvec(folio), folio_nr_pages(folio));