Re: [PATCH 1/4] mm/zsmalloc: Prepare to variable MAX_PHYSMEM_BITS

From: Kirill A. Shutemov
Date: Sat Oct 21 2017 - 04:32:38 EST


On Fri, Oct 20, 2017 at 06:43:55PM -0700, Nitin Gupta wrote:
> On Fri, Oct 20, 2017 at 12:59 PM, Kirill A. Shutemov
> <kirill.shutemov@xxxxxxxxxxxxxxx> wrote:
> > With boot-time switching between paging mode we will have variable
> > MAX_PHYSMEM_BITS.
> >
> > Let's use the maximum variable possible for CONFIG_X86_5LEVEL=y
> > configuration to define zsmalloc data structures.
> >
> > The patch introduces MAX_POSSIBLE_PHYSMEM_BITS to cover such case.
> > It also suits well to handle PAE special case.
> >
>
>
> I see that with your upcoming patch, MAX_PHYSMEM_BITS is turned into a
> variable for x86_64 case as: (pgtable_l5_enabled ? 52 : 46).
>
> Even with this change, I don't see a need for this new
> MAX_POSSIBLE_PHYSMEM_BITS constant.

This is the error, I'm talking about:

mm/zsmalloc.c:249:21: error: variably modified âsize_classâ at file scope
struct size_class *size_class[ZS_SIZE_CLASSES];

ZS_SIZE_CLASSES
ZS_MIN_ALLOC_SIZE
OBJ_INDEX_BITS
_PFN_BITS
MAX_PHYSMEM_BITS
(pgtable_l5_enabled ? 52 : 46)

Check without the patch and full patchset applied.

--
Kirill A. Shutemov