Re: [RFC PATCH 00/16] mm: add in-memory compression of reclaimed pages
From: Mike Rapoport
Date: Mon Nov 16 2026 - 06:24:58 EST
Hi,
On Mon, Nov 16, 2026 at 07:01:06PM +0800, nakixii wrote:
> This is a proof of concept, posted to ask whether the approach is worth
> pursuing. It is not meant for merging. The series is based on Linux
> 6.12.23, not on mm-unstable, and has not been ported to the swap-table
> and zpool changes that have landed since. If there is interest, the
> next version will be rebased onto mm-unstable.
>
> memcomp stores reclaimed anonymous and shmem pages in compressed form
> in memory, using the kernel's compressors and zsmalloc unchanged.
> Reclaim replaces the PTE, or the shmem page-cache entry, with a
> swap-like token that names a 16-byte slot. A fault on the token
> decompresses the page and maps it again. No block device is needed. If
> swap is configured, cold entries can be written back to it. The sysfs
> interface is under /sys/kernel/mm/memcomp.
>
> Results
> =======
>
> The comparison ran 965 fresh guest boots on real application pages,
> under nested KVM on WSL2, with a paired rule fixed before collection.
> Selected results:
>
> Without real swap, single-page refault p99 was 10.7 us against 20.7 us
> for zram with lz4, and 22.0 us against 27.3 us with zstd. Under
> 512 MiB of anonymous pressure, refault p99 was 37% lower than zram
> with lz4 and 36% lower than zswap.
> Completed-switch p99 with zstd was 33-36% lower than zram in 10/10
> rounds and 20-22% lower than zswap in 9/10; these differences were
> smaller than the reference's variation between rounds.
> After writeback, readback p50 over an 832 MiB target was 11.9 us
> against 105.5 us for zswap and 114.0 us for zram writeback, with
> 70-76% fewer bytes written before readback; p99 was about the same.
>
> Less favorable:
>
> With real swap, single-page refault p99 was 4.8 times zram with lz4
> and about 1.5 times zram and zswap with zstd.
> Sequential refault was 30-31% slower than zswap, since there is no
> swap readahead. Single-page pageout p99 was 35-38% slower than zswap.
> In the pageout and refault workload, 64 MiB of real pages per
> application, memcomp used 5-8% more memory than zram; this leaves
> out zram's disksize-sized table, which was larger than the difference.
>
> nakixii (16):
> mm: userfaultfd: check the exclusivity of the page being moved
> mm: add a swap entry type for in-memory compressed pages
> mm: memcomp: compress reclaimed anonymous pages in memory
> mm: userfaultfd: let UFFDIO_MOVE move memcomp entries
> mm: memcomp: charge compressed pages to the source memcg
> mm: memcomp: store shmem and tmpfs pages
> mm: memcomp: write cold pages back to swap
> mm: memcomp: compress foreground batches asynchronously
> mm: memcomp: batch unmap reserved large folios
> mm: memcomp: queue restored large folios for splitting
> mm: memcomp: account user eviction and refault
> mm: memcomp: report precise token residency
> mm: memcomp: add KUnit tests
> selftests/mm: add a memcomp pageout and refault test
> mm: memcomp: add the design doc
> mm: memcomp: add the admin guide
>
> .../ABI/testing/sysfs-kernel-mm-memcomp | 363 +
> .../admin-guide/kernel-parameters.txt | 10 +
> Documentation/admin-guide/mm/index.rst | 1 +
> Documentation/admin-guide/mm/memcomp.rst | 149 +
> Documentation/mm/index.rst | 1 +
> Documentation/mm/memcomp.rst | 215 +
> MAINTAINERS | 12 +
> fs/proc/task_mmu.c | 20 +
> include/linux/memcomp.h | 481 ++
> include/linux/memcontrol.h | 45 +
> include/linux/swap.h | 52 +-
> include/linux/swapops.h | 22 +
> mm/Kconfig | 75 +
> mm/Makefile | 1 +
> mm/hmm.c | 3 +
> mm/huge_memory.c | 44 +
> mm/internal.h | 84 +
> mm/madvise.c | 10 +-
> mm/memcomp.c | 6181 +++++++++++++++++
... (a lot of memcomp/ +++ changes)
> mm/memcontrol.c | 99 +
> mm/memory.c | 42 +-
> mm/migrate.c | 11 +-
> mm/mincore.c | 125 +-
> mm/page_io.c | 42 +
> mm/rmap.c | 41 +-
> mm/shmem.c | 251 +
> mm/swap.h | 4 +
> mm/swap_state.c | 5 +
> mm/swapfile.c | 49 +
> mm/userfaultfd.c | 94 +-
> mm/vmscan.c | 651 +-
> mm/workingset.c | 32 +
> tools/testing/selftests/mm/Makefile | 9 +-
> tools/testing/selftests/mm/config | 11 +
> tools/testing/selftests/mm/hmm-tests.c | 112 +
> tools/testing/selftests/mm/memcomp.c | 831 +++
> 134 files changed, 46825 insertions(+), 14 deletions(-)
This seems to big of a change and the wall of text in your "results"
section does not explain clearly why would we want to bother reading this.
--
Sincerely yours,
Mike.