Re: [RFC PATCH v2 1/8] mm, memcontrol.c: make memcg lru stats thread-safe without lru_lock

From: Daniel Jordan
Date: Wed Sep 12 2018 - 09:30:39 EST


On 9/11/18 12:32 PM, Laurent Dufour wrote:
On 11/09/2018 02:42, Daniel Jordan wrote:
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index d99b71bc2c66..6377dc76dc41 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -99,7 +99,8 @@ struct mem_cgroup_reclaim_iter {
};

struct lruvec_stat {
- long count[NR_VM_NODE_STAT_ITEMS];
+ long node[NR_VM_NODE_STAT_ITEMS];
+ long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS];

It might be better to use different name for the lru_zone_size field to
distinguish it from the one in the mem_cgroup_per_node structure.

Yes, not very grep-friendly. I'll change it to this:

struct lruvec_stat {
long node_stat_cpu[NR_VM_NODE_STAT_ITEMS];
long lru_zone_size_cpu[MAX_NR_ZONES][NR_LRU_LISTS];
};

So the fields are named like the corresponding fields in the mem_cgroup_per_node structure, plus _cpu. And I'm certainly open to other ideas.