Re: [PATCH v3 4/8] memcg: reduce memory for the lruvec and memcg stats

From: Shakeel Butt
Date: Tue Apr 30 2024 - 13:45:50 EST


On Tue, Apr 30, 2024 at 10:30:51AM -0700, T.J. Mercier wrote:
> On Mon, Apr 29, 2024 at 11:06 PM Shakeel Butt <shakeel.butt@xxxxxxxxx> wrote:
> >
> > +
> > +static inline int memcg_stats_index(int idx)
> > +{
> > + return mem_cgroup_stats_index[idx] - 1;
>
> Could this just be: return mem_cgroup_stats_index[idx];
> with a postfix increment of j in init_memcg_stats instead of prefix increment?
>

The -1 is basically for error checking but I will do a followup patch to
initialize the array/indirection-table with -1 and remove the
subtraction from the fast path.

Thanks for the review.