Find a file
Yu Zhao e4dde56cd2 mm: multi-gen LRU: per-node lru_gen_folio lists
For each node, memcgs are divided into two generations: the old and
the young. For each generation, memcgs are randomly sharded into
multiple bins to improve scalability. For each bin, an RCU hlist_nulls
is virtually divided into three segments: the head, the tail and the
default.

An onlining memcg is added to the tail of a random bin in the old
generation. The eviction starts at the head of a random bin in the old
generation. The per-node memcg generation counter, whose reminder (mod
2) indexes the old generation, is incremented when all its bins become
empty.

There are four operations:
1. MEMCG_LRU_HEAD, which moves an memcg to the head of a random bin in
   its current generation (old or young) and updates its "seg" to
   "head";
2. MEMCG_LRU_TAIL, which moves an memcg to the tail of a random bin in
   its current generation (old or young) and updates its "seg" to
   "tail";
3. MEMCG_LRU_OLD, which moves an memcg to the head of a random bin in
   the old generation, updates its "gen" to "old" and resets its "seg"
   to "default";
4. MEMCG_LRU_YOUNG, which moves an memcg to the tail of a random bin
   in the young generation, updates its "gen" to "young" and resets
   its "seg" to "default".

The events that trigger the above operations are:
1. Exceeding the soft limit, which triggers MEMCG_LRU_HEAD;
2. The first attempt to reclaim an memcg below low, which triggers
   MEMCG_LRU_TAIL;
3. The first attempt to reclaim an memcg below reclaimable size
   threshold, which triggers MEMCG_LRU_TAIL;
4. The second attempt to reclaim an memcg below reclaimable size
   threshold, which triggers MEMCG_LRU_YOUNG;
5. Attempting to reclaim an memcg below min, which triggers
   MEMCG_LRU_YOUNG;
6. Finishing the aging on the eviction path, which triggers
   MEMCG_LRU_YOUNG;
7. Offlining an memcg, which triggers MEMCG_LRU_OLD.

Note that memcg LRU only applies to global reclaim, and the
round-robin incrementing of their max_seq counters ensures the
eventual fairness to all eligible memcgs. For memcg reclaim, it still
relies on mem_cgroup_iter().

Link: https://lkml.kernel.org/r/20221222041905.2431096-7-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michael Larabel <Michael@MichaelLarabel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-01-18 17:12:49 -08:00
arch mm/uffd: always wr-protect pte in pte|pmd_mkuffd_wp() 2023-01-18 17:12:37 -08:00
block block-6.2-2023-01-13 2023-01-13 17:41:19 -06:00
certs
crypto
Documentation mm: multi-gen LRU: rename lrugen->lists[] to lrugen->folios[] 2023-01-18 17:12:48 -08:00
drivers - Fix the EDAC device's confusion in the polling setting units 2023-01-15 07:12:58 -06:00
fs mpage: use b_folio in do_mpage_readpage() 2023-01-18 17:12:41 -08:00
include mm: multi-gen LRU: per-node lru_gen_folio lists 2023-01-18 17:12:49 -08:00
init Sync with v6.2-rc4 2023-01-18 16:52:20 -08:00
io_uring io_uring: lock overflowing for IOPOLL 2023-01-13 07:32:46 -07:00
ipc
kernel mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC 2023-01-18 17:12:37 -08:00
lib maple_tree: refine mab_calc_split function 2023-01-18 17:12:47 -08:00
LICENSES
mm mm: multi-gen LRU: per-node lru_gen_folio lists 2023-01-18 17:12:49 -08:00
net
rust
samples
scripts kernel hardening fixes for v6.2-rc4 2023-01-14 10:04:00 -06:00
security mm: new primitive kvmemdup() 2023-01-18 17:12:47 -08:00
sound sound fixes for 6.2-rc4 2023-01-13 08:20:29 -06:00
tools tools/vm/page_owner_sort: free memory before exit 2023-01-18 17:12:45 -08:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap Sync with v6.2-rc4 2023-01-18 16:52:20 -08:00
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS Sync with v6.2-rc4 2023-01-18 16:52:20 -08:00
Makefile Linux 6.2-rc4 2023-01-15 09:22:43 -06:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.