Re: [PATCH v1 1/2] zsmalloc: add allocated objects counter for subpage

From: Sergey Senozhatsky
Date: Wed Jun 21 2023 - 10:18:58 EST


On (23/06/21 13:59), Alexey Romanov wrote:
> On Wed, Jun 21, 2023 at 10:55:18PM +0900, Sergey Senozhatsky wrote:
> > On (23/06/21 13:41), Alexey Romanov wrote:
> > [..]
> > > > +static bool zspage_empty(struct zspage *zspage)
> > > > +{
> > > > + return get_zspage_inuse(zspage) == 0;
> > > > +}
> > > > +
> > > > /**
> > > > * zs_lookup_class_index() - Returns index of the zsmalloc &size_class
> > > > * that hold objects of the provided size.
> > > > @@ -1787,6 +1792,10 @@ static void migrate_zspage(struct zs_pool *pool, struct size_class *class,
> > > > obj_idx++;
> > > > record_obj(handle, free_obj);
> > > > obj_free(class->size, used_obj, NULL);
> > > > +
> > > > + /* Stop if there are no more objects to migrate */
> > > > + if (zspage_empty(get_zspage(s_page)))
> > > > + break;
> > > > }
> > >
> > > Yes it seems my version is not as good as I thought. Looks bad for an
> > > architecturally dependent PAGE_SIZE. [..]
> >
> > Well, we are looking for a solution that is both reasonable (perf wise)
> > and is maintainable.
> >
> > > I can implement this option. I'll test this and send patch this week.
> >
> > Either that or, if Suggested-by: Alexey Romanov <AVRomanov@xxxxxxxxxxxxxx>
> > is good enough for you, then I can send a series tonight or tomorrow (after
> > some testing). I have two more patches on top of that one.
>
> Yeah, Suggested-by is OK. Let's send a patch. Thank you.

Got it.

Let's hear from Minchan first, just to make sure that Minchan is OK
with that.