Re: [PATCH] mm/zsmalloc: avoid unnecessary iteration in get_pages_per_zspage()

From: Sergey Senozhatsky
Date: Wed May 11 2016 - 05:33:11 EST


On (05/09/16 14:01), Minchan Kim wrote:
[..]
> > no, we need cltd there. but ZS_MAX_PAGES_PER_ZSPAGE also affects
> > ZS_MIN_ALLOC_SIZE, which is used in several places, like
> > get_size_class_index(). that's why ZS_MAX_PAGES_PER_ZSPAGE data
> > type change `improves' zs_malloc().
>
> Why not if such simple improves zsmalloc? :)
> Please send a patch.
>
> Thanks a lot, Sergey!

Hello Minchan,

sorry for long reply, I decided to investigate it a bit further.
with this patch, gcc 6.1 -O2 generates "+13" instructions more,
-Os "-25" instructions less. this +13 ins case is a no-no-no.

-ss