Re: [PATCH v4 1/4] mm/zsmalloc: encode class index in obj value for lockless class lookup
From: Barry Song
Date: Wed Jun 10 2026 - 17:28:20 EST
On Wed, Jun 10, 2026 at 11:18 AM Wenchao Hao <haowenchao22@xxxxxxxxx> wrote:
[...]
>
> The "_LOG2" suffix names the math but hides the intent. How about
> renaming them as:
>
> ZS_CHAIN_LOG2 -> ZS_MAX_BITS_PAGES_PER_ZSPAGE
> ZS_MAX_OBJ_PER_PAGE_LOG2 -> ZS_MAX_BITS_OBJS_PER_PAGE
> ZS_OBJ_IDX_DENSE_BITS -> ZS_MAX_BITS_OBJS_PER_ZSPAGE
>
Do we need MAX_ while everybody just uses _BITS? e.g.
#if defined(MAX_POSSIBLE_PHYSMEM_BITS)
#define SWAP_CACHE_PFN_BITS (MAX_POSSIBLE_PHYSMEM_BITS - PAGE_SHIFT)
#elif defined(MAX_PHYSMEM_BITS)
#define SWAP_CACHE_PFN_BITS (MAX_PHYSMEM_BITS - PAGE_SHIFT)
#else
#define SWAP_CACHE_PFN_BITS (BITS_PER_LONG - PAGE_SHIFT)
#endif
Best Regards
Barry