On Thu, Jul 11, 2019 at 09:32:59AM -0400, Yafang Shao wrote: > After commit 815744d75152 ("mm: memcontrol: don't batch updates of local VM stats and events"), > the local VM counters is not in sync with the hierarchical ones. > > Bellow is one example in a leaf memcg on my server (with 8 CPUs), > inactive_file 3567570944 > total_inactive_file 3568029696 > We can find that the deviation is very great, that is because the 'val' in > __mod_memcg_state() is in pages while the effective value in > memcg_stat_show() is in bytes. > So the maximum of this deviation between local VM stats and total VM > stats can be (32 * number_of_cpu * PAGE_SIZE), that may be an unacceptable > great value. > > We should keep the local VM stats in sync with the total stats. > In order to keep this behavior the same across counters, this patch updates > __mod_lruvec_state() and __count_memcg_events() as well. > > Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx> > Cc: Johannes Weiner <hannes@xxxxxxxxxxx> > Cc: Michal Hocko <mhocko@xxxxxxxxxx> > Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx> > Cc: Yafang Shao <shaoyafang@xxxxxxxxxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>