On 4/22/20 10:46 PM, Roman Gushchin wrote: > To convert memcg and lruvec slab counters to bytes there must be > a way to change these counters without touching node counters. > Factor out __mod_memcg_lruvec_state() out of __mod_lruvec_state(). > > Signed-off-by: Roman Gushchin <guro@xxxxxx> Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx> Nit below: > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -713,30 +713,14 @@ parent_nodeinfo(struct mem_cgroup_per_node *pn, int nid) > return mem_cgroup_nodeinfo(parent, nid); > } > > -/** > - * __mod_lruvec_state - update lruvec memory statistics > - * @lruvec: the lruvec > - * @idx: the stat item > - * @val: delta to add to the counter, can be negative > - * > - * The lruvec is the intersection of the NUMA node and a cgroup. This > - * function updates the all three counters that are affected by a > - * change of state at this level: per-node, per-cgroup, per-lruvec. > - */ > -void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, > - int val) > +void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, > + int val) > { > pg_data_t *pgdat = lruvec_pgdat(lruvec); Looks like the pgdat can now be moved into the MEMCG_CHARGE_BATCH if().