Re: [PATCH v1] zram: add size class equals check into recompression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 25, 2022 at 07:08:54PM +0900, Sergey Senozhatsky wrote:
> On (22/10/25 09:49), Aleksey Romanov wrote:
> > On Tue, Oct 25, 2022 at 11:04:40AM +0900, Sergey Senozhatsky wrote:
> > > On (22/10/25 10:53), Sergey Senozhatsky wrote:
> > > > > +unsigned int zs_get_class_size(struct zs_pool *pool, unsigned int size)
> > > > > +{
> > > > > +	struct size_class *class = pool->size_class[get_size_class_index(size)];
> > > > > +
> > > > > +	return class->size;
> > > > > +}
> > > > > +EXPORT_SYMBOL_GPL(zs_get_class_size);
> 
> I wonder if we want to return class->index instead of class->size?
> 
> Something like this (a sketch)
> 
>   Return: the index of the zsmalloc &size_class that hold objects of the
>   provided size.
> 
> unsigned int zs_lookup_class_index(struct zs_pool *pool, unsigned int size)
> {
>         struct size_class *class = pool->size_class[get_size_class_index(size)];
> 
>         return class->index;
> }

Sure. I think it would be more logical, and perhaps such a function
would be more applicable in other cases, in the future.

Will you fix it in your cherry-pick?

-- 
Thank you,
Alexey




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux