Commit 84f941ba authored by Sergey Senozhatsky's avatar Sergey Senozhatsky Committed by Jinjiang Tu
Browse files

zram: do not waste zram_table_entry flags bits

mainline inclusion
from mainline-v6.1-rc1
commit f635725c
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7TWVA
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f635725c3905e755a8c3e2dc8cab7fcd0d38977f

-------------------------------------------

zram_table_entry::flags stores object size in the lower bits and zram
pageflags in the upper bits.  However, for some reason, we use 24 lower
bits, while maximum zram object size is PAGE_SIZE, which requires
PAGE_SHIFT bits (up to 16 on arm64).  This wastes 24 - PAGE_SHIFT bits
that we can use for additional zram pageflags instead.

Also add a BUILD_BUG_ON() to alert us should we run out of bits in
zram_table_entry::flags.

Link: https://lkml.kernel.org/r/20220912152744.527438-1-senozhatsky@chromium.org


Signed-off-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: default avatarBrian Geffon <bgeffon@google.com>
Acked-by: default avatarMinchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 518d7451
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment