2023-12-12 17:17:52

by Catalin Marinas

[permalink] [raw]
Subject: Re: [PATCH v9 3/4] arm64: mte: add compression support to mteswap.c

On Mon, Nov 13, 2023 at 11:52:32AM +0100, Alexander Potapenko wrote:
> Update mteswap.c to perform inline compression of memory tags when
> possible.
>
> If CONFIG_ARM64_MTE_COMP is enabled, mteswap.c will attempt to compress
> saved tags for a struct page and store them directly in Xarray entry
> instead of wasting heap space.
>
> Soon after booting Android, tag compression saves ~2x memory previously
> spent by mteswap.c on tag allocations. On a moderately loaded device with
> ~20% tagged pages, this leads to saving several megabytes of kernel heap:
>
> # cat /sys/kernel/debug/mteswap/stats
> 8 bytes: 102496 allocations, 67302 deallocations
> 128 bytes: 212234 allocations, 178278 deallocations
> uncompressed tag storage size: 8851200
> compressed tag storage size: 4346368
>
> (statistics collection is introduced in the following patch)
>
> Signed-off-by: Alexander Potapenko <[email protected]>

Reviewed-by: Catalin Marinas <[email protected]>