Skip to content

Commit

Permalink
mm: multigenerational lru: eviction
Browse files Browse the repository at this point in the history
The eviction consumes old generations. Given an lruvec, the eviction
scans the pages on the per-zone lists indexed by either of min_seq[2].
It first tries to select a type based on the values of min_seq[2].
When anon and file types are both available from the same generation,
it selects the one that has a lower refault rate.

During a scan, the eviction sorts pages according to their new
generation numbers, if the aging has found them referenced. It also
moves pages from the tiers that have higher refault rates than tier 0
to the next generation. When it finds all the per-zone lists of a
selected type are empty, the eviction increments min_seq[2] indexed by
this selected type.

With the aging and the eviction in place, we can build page reclaim in
a straightforward manner:
  1) In order to reduce the latency, direct reclaim only invokes the
  aging when both min_seq[2] reaches max_seq-1; otherwise it invokes
  the eviction.
  2) In order to avoid the aging in the direct reclaim path, kswapd
  does the background aging. It invokes the aging when either of
  min_seq[2] reaches max_seq-1; otherwise it invokes the eviction.

Signed-off-by: Yu Zhao <yuzhao@google.com>
Tested-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
  • Loading branch information
yuzhaogoogle authored and xanmod committed Jun 28, 2021
1 parent 2f9e3a8 commit 48f06a6
Show file tree
Hide file tree
Showing 2 changed files with 545 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/linux/mmzone.h
Expand Up @@ -863,6 +863,8 @@ struct deferred_split {
};
#endif

struct mm_walk_args;

/*
* On NUMA machines, each NUMA node would have a pg_data_t to describe
* it's memory layout. On UMA machines there is a single pglist_data which
Expand Down Expand Up @@ -968,6 +970,9 @@ typedef struct pglist_data {

unsigned long flags;

#ifdef CONFIG_LRU_GEN
struct mm_walk_args *mm_walk_args;
#endif
ZONE_PADDING(_pad2_)

/* Per-node vmstats */
Expand Down

0 comments on commit 48f06a6

Please sign in to comment.