Re: [PATCH v5 08/12] zsmalloc: introduce zspage structure

Sergey Senozhatsky
2016-05-17T01:27:26Z

On (05/17/16 10:14), Minchan Kim wrote:
[..]
> > can we also switch create_cache() to errnos? I just like a bit
> > better
> > return -ENOMEM;
> > else
> > return 0;
> >
> > than
> >
> > return 1;
> > else
> > return 0;
> >
>
> Hmm, of course, I can do it easily.
> But zs_create_pool returns NULL without error propagation from sub
> functions so I don't see any gain from returning errno from
> create_cache. I don't mean I hate it but just need a justificaion
> to persuade grumpy me.

:) not married to those errnos. can skip it.

> > > +static struct zspage *isolate_zspage(struct size_class *class, bool source)
> > > {
> > > + struct zspage *zspage;
> > > + enum fullness_group fg[2] = {ZS_ALMOST_EMPTY, ZS_ALMOST_FULL};
> > > + if (!source) {
> > > + fg[0] = ZS_ALMOST_FULL;
> > > + fg[1] = ZS_ALMOST_EMPTY;
> > > + }
> > > +
> > > + for (i = 0; i < 2; i++) {
> >
> > sorry, why not "for (i = ZS_ALMOST_EMPTY; i <= ZS_ALMOST_FULL ..." ?
>
> For source zspage, the policy is to find a fragment object from ZS_ALMOST_EMPTY.
> For target zspage, the policy is to find a fragment object from ZS_ALMOST_FULL.
>
> Do I misunderstand your question?

ahhh... sorry, it's just me being silly. I got it now.

-ss