zram: add size class equals check into recompression
authorAlexey Romanov <avromanov@sberdevices.ru>
Wed, 9 Nov 2022 11:50:42 +0000 (20:50 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 30 Nov 2022 23:58:52 +0000 (15:58 -0800)
commit7c2af309abd24ff4e313246bf9b68f398d95c871
tree75af9d314190c3812a1ec8a7ba37b2997ef01321
parentf24ee92cbe13242758635e654b2422dbf4912e4b
zram: add size class equals check into recompression

It makes no sense for us to recompress the object if it will be in the
same size class.  We anyway don't get any memory gain.  But, at the same
time, we get a CPU time overhead when inserting this object into zspage
and decompressing it afterwards.

[senozhatsky: rebased and fixed conflicts]
Link: https://lkml.kernel.org/r/20221109115047.2921851-9-senozhatsky@chromium.org
Signed-off-by: Alexey Romanov <avromanov@sberdevices.ru>
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Suleiman Souhlal <suleiman@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/block/zram/zram_drv.c
include/linux/zsmalloc.h
mm/zsmalloc.c