Re: [PATCHv2 3/6] zsmalloc: fine-grained inuse ratio based fullness grouping

From: Minchan Kim
Date: Wed Mar 01 2023 - 19:13:28 EST


On Wed, Mar 01, 2023 at 01:05:20PM +0900, Sergey Senozhatsky wrote:
> On (23/02/28 14:53), Minchan Kim wrote:
> [..]
> > > As of why I decided to go with defines, this is because zspage fullness
> > > values and class stats are two conceptually different things, they don't
> > > really fit in one single enum, unless enum's name is "zs_constants".
> > > What do you think?
> >
> > Agree. We don't need to combine them, then.
> > BTW, I still prefer the enum instead of 10 define.
> >
> > enum fullness_group {
> > ZS_EMPTY,
> > ZS_INUSE_RATIO_MIN,
> > ZS_INUSE_RATIO_ALMOST_FULL = 7,
> > ZS_INUSE_RATIO_MAX = 10,
> > ZS_FULL,
> > NR_ZS_FULLNESS,
> > }
>
> So we keep enum nesting? Sorry, I'm not exactly following.

Sorry, I meant let's keep separating them since they are different
things conceptually as you mentioned.

>
> We have fullness values (which we use independently) and stats array
> which has overlapping offsets with fullness values.
>
> [..]
> > > I can change it to
> > >
> > > for (r = ZS_INUSE_RATIO_10; r <= ZS_INUSE_RATIO_70; r++)
> > > and
> > > for (r = ZS_INUSE_RATIO_80; r <= ZS_INUSE_RATIO_99; r++)
> > >
> > > which would be safer than using hard-coded numbers.
> >
> > I didn't mean to have hard code either but just wanted to show
> > the intention to use the loop.
>
> Got it. I just wanted to show that being very verbose (having every
> constant documented) is nice :)
>
> > >
> > > Shall we actually instead report per inuse ratio stats instead? I sort
> > > of don't see too many reasons to keep that below/above 3/4 thing.
> >
> > Oh, yeah. Since it's debugfs, we would get excuse to break.
>
> This was in my original patch, but I decided to put a comment and keep
> the old behavior. I probably will switch to a more precise reporting
> (per inuse ratio) in a separate patch, so that we can easily revert it
> without any impact on new fullness grouping.

Sounds good.