mm-multi-gen-lru-section-for-memcg-lru.patch removed from -mm tree
The quilt patch titled
Subject: mm: multi-gen LRU: section for memcg LRU
has been removed from the -mm tree. Its filename was
mm-multi-gen-lru-section-for-memcg-lru.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "T.J. Alumbaugh" <[email protected]>
Subject: mm: multi-gen LRU: section for memcg LRU
Date: Wed, 18 Jan 2023 00:18:24 +0000
Move memcg LRU code into a dedicated section. Improve the design doc to outline its architecture.
Signed-off-by T.J. Alumbaugh <[email protected]>
Cc Yu Zhao <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
Documentation/mm/multigen_lru.rst renamed from Documentation/mm/multigen_lru.rst~mm-multi-gen-lru-section-for-memcg-lru +32 -1
@@ -186,9 +186,40 @@ is false positive, the cost is an additi which may yield hot pages anyway. Parameters of the filter itself can control the false positive rate in the limit. +Memcg LRU +--------- +An memcg LRU is a per-node LRU of memcgs. It is also an LRU of LRUs, +since each node and memcg combination has an LRU of folios (see +``mem_cgroup_lruvec()``). Its goal is to improve the scalability of +global reclaim, which is critical to system-wide memory overcommit in +data centers. Note that memcg LRU only applies to global reclaim. + +The basic structure of an memcg LRU can be understood by an analogy to +the active/inactive LRU (of folios): + +1. It has the young and the old (generations), i.e., the counterparts + to the active and the inactive; +2. The increment of ``max_seq`` triggers promotion, i.e., the + counterpart to activation; +3. Other events trigger similar operations, e.g., offlining an memcg + triggers demotion, i.e., the counterpart to deactivation. + +In terms of global reclaim, it has two distinct features: + +1. Sharding, which allows each thread to start at a random memcg (in + the old generation) and improves parallelism; +2. Eventual fairness, which allows direct reclaim to bail out at will + and reduces latency without affecting fairness over some time. + +In terms of traversing memcgs during global reclaim, it improves the +best-case complexity from O(n) to O(1) and does not affect the +worst-case complexity O(n). Therefore, on average, it has a sublinear +complexity. + Summary ------- -The multi-gen LRU can be disassembled into the following parts: +The multi-gen LRU (of folios) can be disassembled into the following +parts: * Generations * Rmap walks
include/linux/mm_inline.h renamed from include/linux/mm_inline.h~mm-multi-gen-lru-section-for-memcg-lru +0 -17
@@ -122,18 +122,6 @@ static inline bool lru_gen_in_fault(voidreturn current->in_lru_fault; } -#ifdef CONFIG_MEMCG -static inline int lru_gen_memcg_seg (struct lruvec *lruvec) -{ -return READ_ONCE (lruvec->lrugen.seg); -} -#else -static inline int lru_gen_memcg_seg (struct lruvec *lruvec) -{ -return 0 ; -} -#endif -static inline int lru_gen_from_seq (unsigned long seq) {return seq %MAX_NR_GENS ;
@@ -309,11 +297,6 @@ static inline bool lru_gen_in_fault(voidreturn false; } -static inline int lru_gen_memcg_seg (struct lruvec *lruvec) -{ -return 0 ; -} -static inline bool lru_gen_add_folio (struct lruvec *lruvec,struct folio *folio,bool reclaiming) {return false;
include/linux/mmzone.h renamed from include/linux/mmzone.h~mm-multi-gen-lru-section-for-memcg-lru +2 -11
@@ -368,15 +368,6 @@ struct page_vma_mapped_walk;#define LRU_GEN_MASK ((BIT(LRU_GEN_WIDTH) - 1) << LRU_GEN_PGOFF)#define LRU_REFS_MASK ((BIT(LRU_REFS_WIDTH) - 1) << LRU_REFS_PGOFF) -/* see the comment on MEMCG_NR_GENS */ -enum { -MEMCG_LRU_NOP , -MEMCG_LRU_HEAD , -MEMCG_LRU_TAIL , -MEMCG_LRU_OLD , -MEMCG_LRU_YOUNG , -}; -#ifdef CONFIG_LRU_GEN enum {
@@ -557,7 +548,7 @@ void lru_gen_exit_memcg(struct mem_cgrouvoid lru_gen_online_memcg (struct mem_cgroup *memcg);void lru_gen_offline_memcg (struct mem_cgroup *memcg);void lru_gen_release_memcg (struct mem_cgroup *memcg); -void lru_gen_rotate_memcg (struct lruvec *lruvec,int op); +void lru_gen_soft_reclaim (struct lruvec *lruvec);#else /* !CONFIG_MEMCG */
@@ -608,7 +599,7 @@ static inline void lru_gen_release_memcg { } -static inline void lru_gen_rotate_memcg (struct lruvec *lruvec,int op) +static inline void lru_gen_soft_reclaim (struct lruvec *lruvec) { }
mm/memcontrol.c renamed from mm/memcontrol.c~mm-multi-gen-lru-section-for-memcg-lru +2 -6
@@ -476,12 +476,8 @@ static void mem_cgroup_update_tree(strucstruct mem_cgroup_tree_per_node *mctz;if (lru_gen_enabled ()) { -struct lruvec *lruvec = &memcg->nodeinfo[nid]->lruvec; - -/* see the comment on MEMCG_NR_GENS */ -if (soft_limit_excess (memcg) &&lru_gen_memcg_seg (lruvec) !=MEMCG_LRU_HEAD ) -lru_gen_rotate_memcg (lruvec,MEMCG_LRU_HEAD ); - +if (soft_limit_excess (memcg)) +lru_gen_soft_reclaim (&memcg->nodeinfo[nid]->lruvec);return ; }
mm/vmscan.c renamed from mm/vmscan.c~mm-multi-gen-lru-section-for-memcg-lru +142 -108
268 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are