On Tue, Jun 16, 2020 at 06:52:09PM -0700, Shakeel Butt wrote: > On Mon, Jun 8, 2020 at 4:07 PM Roman Gushchin <guro@xxxxxx> 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> > > Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> > > Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx> > > --- > > include/linux/memcontrol.h | 17 +++++++++++++++ > > mm/memcontrol.c | 43 +++++++++++++++++++++----------------- > > 2 files changed, 41 insertions(+), 19 deletions(-) > > > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > > index bbf624a7f5a6..93dbc7f9d8b8 100644 > > --- a/include/linux/memcontrol.h > > +++ b/include/linux/memcontrol.h > > @@ -679,11 +679,23 @@ static inline unsigned long lruvec_page_state_local(struct lruvec *lruvec, > > return x; > > } > > > > +void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, > > + int val); > > void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, > > int val); > > void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val); > > void mod_memcg_obj_state(void *p, int idx, int val); > > > > +static inline void mod_memcg_lruvec_state(struct lruvec *lruvec, > > + enum node_stat_item idx, int val) > > Is this function used in later patches? Any benefit introducing it > here instead of in the patch where it is used for the first time? Yes, it's used in "mm: memcg/slab: charge individual slab objects instead of pages". It's a fairly large patchset with many internal dependencies, so there is always a trade-off between putting everything into a single patch, which is hard to review, and splitting out some changes, which make not much sense without seeing the whole picture. In this particular case splitting out a formal and easy-to-verify change makes the actual non-trivial patch smaller and hopefully easier for a review. But of course it's all subjective. Thanks!