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

From: Sergey Senozhatsky
Date: Tue Jun 20 2023 - 06:36:40 EST


On (23/06/19 17:35), Alexey Romanov wrote:
>
> We use a variable of type unsigned int to store the offset
> of the first object at the subpage In turn, the offset cannot
> exceed the size of PAGE_SIZE, which is usually 4096. Thus,
> 12 bits are enough to store the offset.

[..]

> If the page size is 4Kb

It's certainly not a given. PAGE_SIZE is architecture specific.
PAGE_SIZE_16KB and PAGE_SIZE_64KB would be simple examples, but there
are, apparently, architectures that even can have PAGE_SIZE_256KB.