linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [v2 0/5] Implement MTE tag compression for swapped pages
@ 2023-07-13 12:57 Alexander Potapenko
  2023-07-13 12:57 ` [v2 1/5] lib/bitmap: add bitmap_{set,get}_value_unaligned() Alexander Potapenko
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Alexander Potapenko @ 2023-07-13 12:57 UTC (permalink / raw)
  To: glider, catalin.marinas, will, pcc, andreyknvl, andriy.shevchenko,
	linux, yury.norov
  Cc: linux-kernel, linux-arm-kernel, eugenis

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 also extend <linux/bitmap.h>
with methods to set/get bit values at arbitrary places in the map.

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.

v2:
 - as suggested by Yuri Norov, replace the poorly implemented struct
   bitq with <linux/bitmap.h>

Alexander Potapenko (5):
  lib/bitmap: add bitmap_{set,get}_value_unaligned()
  lib/test_bitmap: add tests for bitmap_{set,get}_value_unaligned
  arm64: mte: implement CONFIG_ARM64_MTE_COMP
  arm64: mte: add a test for MTE tags compression
  arm64: mte: add compression support to mteswap.c

 arch/arm64/Kconfig               |  20 ++
 arch/arm64/include/asm/mtecomp.h |  60 +++++
 arch/arm64/mm/Makefile           |   7 +
 arch/arm64/mm/mtecomp.c          | 412 +++++++++++++++++++++++++++++++
 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 +++++++++++++
 include/linux/bitmap.h           |  63 +++++
 lib/test_bitmap.c                |  34 +++
 11 files changed, 878 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

-- 
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

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-07-14 12:31 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-13 12:57 [v2 0/5] Implement MTE tag compression for swapped pages Alexander Potapenko
2023-07-13 12:57 ` [v2 1/5] lib/bitmap: add bitmap_{set,get}_value_unaligned() Alexander Potapenko
2023-07-13 17:28   ` Andy Shevchenko
2023-07-13 18:05     ` Alexander Potapenko
2023-07-14  8:04       ` Andy Shevchenko
2023-07-14 11:19         ` William Breathitt Gray
2023-07-14 11:28           ` Andy Shevchenko
2023-07-14 12:07             ` Alexander Potapenko
2023-07-14 12:30               ` Andy Shevchenko
2023-07-13 12:57 ` [v2 2/5] lib/test_bitmap: add tests for bitmap_{set,get}_value_unaligned Alexander Potapenko
2023-07-13 12:57 ` [v2 3/5] arm64: mte: implement CONFIG_ARM64_MTE_COMP Alexander Potapenko
2023-07-13 16:37   ` Alexander Potapenko
2023-07-13 17:23   ` Andy Shevchenko
2023-07-13 19:27     ` Yury Norov
2023-07-14  8:01       ` Andy Shevchenko
2023-07-14  9:25     ` Alexander Potapenko
2023-07-14 10:47       ` Andy Shevchenko
2023-07-14 11:17         ` Alexander Potapenko
2023-07-13 12:57 ` [v2 4/5] arm64: mte: add a test for MTE tags compression Alexander Potapenko
2023-07-13 12:57 ` [v2 5/5] arm64: mte: add compression support to mteswap.c Alexander Potapenko

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).