From: Alexander Potapenko <glider@google.com>
To: glider@google.com, catalin.marinas@arm.com, will@kernel.org,
pcc@google.com, andreyknvl@gmail.com
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, eugenis@google.com,
yury.norov@gmail.com
Subject: [PATCH 0/5] Implement MTE tag compression for swapped pages
Date: Tue, 11 Jul 2023 16:33:27 +0200 [thread overview]
Message-ID: <20230711143337.3086664-1-glider@google.com> (raw)
Currently, when MTE pages are swapped out, the tags are kept in the
memory, occupying 128 bytes per page. This is especially problematic
for devices that use zram-backed in-memory swap, because tags stored
uncompressed in the heap effectively reduce the available amount of
swap memory.
The RLE-based EA0 algorithm suggested by Evgenii Stepanov and
implemented in this patch series is able to efficiently compress
128-byte tag buffers, resulting in practical compression ratio between
2.5x and 20x. In most cases it is possible to store the compressed data
in 63-bit Xarray values, resulting in no extra memory allocations.
Our measurements show that EA0 provides better compression than existing
kernel compression algorithms (LZ4, LZO, LZ4HC, ZSTD) can offer, because
EA0 specifically targets 128-byte buffers.
To implement compression/decompression, we introduce <linux/bitqueue.h>,
which provides a simple bit queue interface.
We refactor arch/arm64/mm/mteswap.c to support both the compressed
(CONFIG_ARM64_MTE_COMP) and non-compressed case. For the former, in
addition to tag compression, we move tag allocation from kmalloc() to
separate kmem caches, providing greater locality and relaxing the
alignment requirements.
Alexander Potapenko (5):
linux/bitqueue.h: add a KUnit test for bitqueue.h
arm64: mte: implement CONFIG_ARM64_MTE_COMP
arm64: mte: add a test for MTE tags compression
arm64: mte: add compression support to mteswap.c
fixup mteswap
arch/arm64/Kconfig | 20 ++
arch/arm64/include/asm/mtecomp.h | 60 +++++
arch/arm64/mm/Makefile | 7 +
arch/arm64/mm/mtecomp.c | 398 +++++++++++++++++++++++++++++++
arch/arm64/mm/mteswap.c | 19 +-
arch/arm64/mm/mteswap.h | 12 +
arch/arm64/mm/mteswap_comp.c | 50 ++++
arch/arm64/mm/mteswap_nocomp.c | 37 +++
arch/arm64/mm/test_mtecomp.c | 175 ++++++++++++++
lib/Kconfig.debug | 8 +
lib/Makefile | 1 +
lib/test_bitqueue.c | 244 +++++++++++++++++++
12 files changed, 1020 insertions(+), 11 deletions(-)
create mode 100644 arch/arm64/include/asm/mtecomp.h
create mode 100644 arch/arm64/mm/mtecomp.c
create mode 100644 arch/arm64/mm/mteswap.h
create mode 100644 arch/arm64/mm/mteswap_comp.c
create mode 100644 arch/arm64/mm/mteswap_nocomp.c
create mode 100644 arch/arm64/mm/test_mtecomp.c
create mode 100644 lib/test_bitqueue.c
--
2.41.0.255.g8b1d071c50-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2023-07-11 14:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 14:33 Alexander Potapenko [this message]
2023-07-11 14:33 ` [PATCH 1/5] linux/bitqueue.h: add a KUnit test for bitqueue.h Alexander Potapenko
2023-07-11 14:33 ` [PATCH 1/5] linux/bitqueue.h: add the bit queue implementation Alexander Potapenko
2023-07-11 14:33 ` [PATCH 2/5] arm64: mte: implement CONFIG_ARM64_MTE_COMP Alexander Potapenko
2023-07-11 14:33 ` [PATCH 2/5] linux/bitqueue.h: add a KUnit test for bitqueue.h Alexander Potapenko
2023-07-11 14:33 ` [PATCH 3/5] arm64: mte: add a test for MTE tags compression Alexander Potapenko
2023-07-11 14:33 ` [PATCH 3/5] arm64: mte: implement CONFIG_ARM64_MTE_COMP Alexander Potapenko
2023-07-11 14:33 ` [PATCH 4/5] arm64: mte: add a test for MTE tags compression Alexander Potapenko
2023-07-11 14:33 ` [PATCH 4/5] arm64: mte: add compression support to mteswap.c Alexander Potapenko
2023-07-11 14:33 ` [PATCH 5/5] " Alexander Potapenko
2023-07-11 14:33 ` [PATCH 5/5] fixup mteswap Alexander Potapenko
2023-07-11 14:37 ` [PATCH 0/5] Implement MTE tag compression for swapped pages Alexander Potapenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230711143337.3086664-1-glider@google.com \
--to=glider@google.com \
--cc=andreyknvl@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=eugenis@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pcc@google.com \
--cc=will@kernel.org \
--cc=yury.norov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).