lkml.org 
[lkml]   [2018]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv2 2/2] zram: drop max_zpage_size and use zs_huge_class_size()
On (03/13/18 22:58), Minchan Kim wrote:
> > > If it is static, we can do this in zram_init? I believe it's more readable in that
> > > it's never changed betweens zram instances.
> >
> > We need to have at least one pool, because pool decides where the
> > watermark is. At zram_init() stage we don't have a pool yet. We
> > zs_create_pool() in zram_meta_alloc() so that's why I put
> > zs_huge_class_size() there. I'm not in love with it, but that's
> > the only place where we can have it.
>
> Fair enough. Then what happens if client calls zs_huge_class_size
> without creating zs_create_pool?

Will receive 0.
One of the version was returning SIZE_MAX in such case.

size_t zs_huge_class_size(void)
{
+ if (unlikely(!huge_class_size))
+ return SIZE_MAX;
return huge_class_size;
}

> I think we should make zs_huge_class_size has a zs_pool as argument.

Can do, but the param will be unused. May be we can do something
like below instead:

size_t zs_huge_class_size(void)
{
+ if (unlikely(!huge_class_size))
+ return 3 * PAGE_SIZE / 4;
return huge_class_size;
}

Should do no harm (unless I'm missing something).

-ss

\
 
 \ /
  Last update: 2018-03-13 15:18    [W:0.086 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site