path: root/mm/workingset.c
diff options
authorJohannes Weiner <>2017-07-06 15:40:52 -0700
committerLinus Torvalds <>2017-07-06 16:24:35 -0700
commit00f3ca2c2d6635d85108571c4dd9a29088668662 (patch)
treed85532fc7416bcb2dc7c442f8ebf5536fb684ad5 /mm/workingset.c
parented52be7bfd45533b194b429f43361493d24599a7 (diff)
mm: memcontrol: per-lruvec stats infrastructure
lruvecs are at the intersection of the NUMA node and memcg, which is the scope for most paging activity. Introduce a convenient accounting infrastructure that maintains statistics per node, per memcg, and the lruvec itself. Then convert over accounting sites for statistics that are already tracked in both nodes and memcgs and can be easily switched. [ fix crash in the new cgroup stat keeping code] Link: [ don't track uncharged pages at all Link: [ add missing free_percpu()] Link: [ hexagon: fix build error caused by include file order] Link: Link: Signed-off-by: Johannes Weiner <> Signed-off-by: Guenter Roeck <> Acked-by: Vladimir Davydov <> Cc: Josef Bacik <> Cc: Michal Hocko <> Cc: Rik van Riel <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/workingset.c')
1 files changed, 3 insertions, 6 deletions
diff --git a/mm/workingset.c b/mm/workingset.c
index b8c9ab678479..7119cd745ace 100644
--- a/mm/workingset.c
+++ b/mm/workingset.c
@@ -288,12 +288,10 @@ bool workingset_refault(void *shadow)
refault_distance = (refault - eviction) & EVICTION_MASK;
- inc_node_state(pgdat, WORKINGSET_REFAULT);
- inc_memcg_state(memcg, WORKINGSET_REFAULT);
+ inc_lruvec_state(lruvec, WORKINGSET_REFAULT);
if (refault_distance <= active_file) {
- inc_node_state(pgdat, WORKINGSET_ACTIVATE);
- inc_memcg_state(memcg, WORKINGSET_ACTIVATE);
+ inc_lruvec_state(lruvec, WORKINGSET_ACTIVATE);
return true;
@@ -474,8 +472,7 @@ static enum lru_status shadow_lru_isolate(struct list_head *item,
if (WARN_ON_ONCE(node->exceptional))
goto out_invalid;
- inc_node_state(page_pgdat(virt_to_page(node)), WORKINGSET_NODERECLAIM);
- inc_memcg_page_state(virt_to_page(node), WORKINGSET_NODERECLAIM);
+ inc_lruvec_page_state(virt_to_page(node), WORKINGSET_NODERECLAIM);
__radix_tree_delete_node(&mapping->page_tree, node,
workingset_update_node, mapping);