Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f041f18
make: Add optional LZ4 support
rst0git Mar 15, 2026
690b9f8
images: Add compressed page metadata
rst0git Mar 15, 2026
11345e3
compression: Add LZ4 page helpers
rst0git Mar 15, 2026
340bdd8
criu: Define memory compression settings
rst0git Jul 11, 2026
7a5efc7
page-xfer: Fix page-server descriptor cleanup
rst0git Jul 13, 2026
26a0ee2
page-xfer: Write compressed page images
rst0git Mar 15, 2026
0c0d960
pagemap: Document page_read state
rst0git Mar 15, 2026
513fb3f
pagemap: Read compressed page images
rst0git Mar 15, 2026
da56e4e
pagemap: Cache decoded regions for partial reads
rst0git Jul 8, 2026
b946051
pagemap: Bound compressed asynchronous reads
rst0git Apr 6, 2026
34bda0e
mem/pagemap: Decode LZ4 pages before PIE
rst0git Jul 11, 2026
98e8036
image: Version compressed page payloads
rst0git Jul 11, 2026
948af5e
crtools/rpc/libcriu: Expose page compression
rst0git Jul 11, 2026
7403457
test: Cover compressed page restore paths
rst0git Mar 15, 2026
45bb11a
unittest: Test page compression and concurrency
rst0git Jul 10, 2026
5ae516b
crit: Convert memory page compression offline
rst0git Jul 11, 2026
45af790
contrib: Benchmark memory page compression
rst0git Jul 11, 2026
e52370d
contrib: Benchmark region-cache restores
rst0git Jul 10, 2026
34076a2
contrib: Benchmark SGLang compression
rst0git Jul 10, 2026
8f8488d
contrib: Benchmark vLLM compression
rst0git Jul 11, 2026
f75201f
test/others: Test compression benchmark tooling
rst0git Jul 12, 2026
4c385bb
test/others: Cover mixed compression chains
rst0git Jul 10, 2026
590ca31
test/others: Cover all-raw compression entries
rst0git Jul 11, 2026
dbfb156
test/others: Run compression benchmark in CI
rst0git Jul 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/check-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
# Checkout pull request HEAD commit instead of merge commit
ref: ${{ github.event.pull_request.head.sha }}
- name: Install dependencies
run: sudo contrib/apt-install libprotobuf-dev libprotobuf-c-dev protobuf-c-compiler protobuf-compiler python3-protobuf libnl-3-dev libnet-dev libcap-dev uuid-dev
run: sudo contrib/apt-install libprotobuf-dev libprotobuf-c-dev protobuf-c-compiler protobuf-compiler python3-protobuf libnl-3-dev libnet-dev libcap-dev uuid-dev liblz4-dev
- name: Configure git user details
run: |
git config --global user.email "checkpoint-restore@users.noreply.github.com"
Expand All @@ -28,3 +28,8 @@ jobs:
run: git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
- name: Build each commit
run: git rebase ${{ github.base_ref }} -x "make -C scripts/ci check-commit"
- name: Build without LZ4
run: |
make mrproper
make -j "$(nproc)" NO_LZ4=1
make unittest NO_LZ4=1
38 changes: 38 additions & 0 deletions Documentation/crit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ SYNOPSIS

*crit* 'show' [-h] in

*crit* 'compress' [-h] [--in-place] [--acceleration N] dir

*crit* 'decompress' [-h] [--in-place] dir

DESCRIPTION
-----------
*crit* is a feature-rich replacement for existing *criu* show.
Expand All @@ -43,12 +47,46 @@ Positional Arguments
*show*::
convert *criu* image from binary to human-readable JSON

*compress*::
compress memory page images in a checkpoint directory using CRIU's
per-page LZ4 format. The command rewrites *pages-*.img*,
*pagemap-*.img*, and *inventory.img*. Pages that are zero-filled or
do not meet CRIU's compression threshold are stored without an LZ4
payload. By default, the original files are preserved with a *.bak*
suffix; use *--in-place* to skip these backup files. The inventory
is updated to record compression metadata and the compressed-image
version. Existing *.bak* files are never overwritten.

*decompress*::
decompress memory page images in a checkpoint directory back to
uncompressed page payloads. The command removes compression metadata
from the pagemap and inventory images. When the directory has no parent
reference, the command also restores the normal image version. It retains
the compressed-image version for incremental checkpoints because a parent
may still contain compressed payloads. By default, rewritten files are
preserved with a *.bak* suffix; use *--in-place* to skip these backup
files. Existing *.bak* files are never overwritten.

Both transformations preserve the ownership, permissions, ACLs, security
labels, and other extended attributes of rewritten images. All output is
staged and synchronized before it is installed. If a write, rename, *SIGHUP*,
*SIGINT*, or *SIGTERM* interrupts the commit, CRIT restores the complete
original image set instead of leaving a partially transformed set.

Optional Arguments
~~~~~~~~~~~~~~~~~~

*-h*, *--help*::
Print some help and exit

*--in-place*::
Rewrite files without creating *.bak* backup files. This option is
accepted by *compress* and *decompress*.

*--acceleration* 'N'::
Set the LZ4 acceleration level used by *compress*. Higher values
trade compression ratio for speed.

SEE ALSO
--------
criu(8)
Expand Down
54 changes: 54 additions & 0 deletions Documentation/criu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,60 @@ mount -t cgroup -o devices,freezer none devices,freezer
Allows to link unlinked files back, if possible (modifies filesystem
during *restore*).

*-c, --compress*::
Enable LZ4 per-page compression of memory pages during *dump*.
Each system page is compressed as an independent LZ4 block.
Zero-filled pages are detected and stored with no data; pages that
do not compress well are stored raw to avoid decompression overhead
on *restore*. The compression choice made at *dump* time is recorded
in the inventory image and applied automatically on *restore*.
Compatible with *--page-server* when *--tls* is not used, *--stream*,
*--lazy-pages*, iterative checkpointing, *--auto-dedup*, and the *dedup*
command.

*--compress-region* 'size'::
Enable LZ4 region compression of memory pages during *dump*.
A run of consecutive pages totalling 'size' bytes is compressed as
a single LZ4 block, which yields a better ratio and faster dump
on heap-shaped data than per-page compression at the cost of
slightly slower restore on partial reads. 'size' accepts K/M/G
suffixes (e.g. *256K*, *1M*); it must be a multiple of the system
page size and at most 4M. Mutually exclusive with *--compress*.
Currently supports only the local image path (no
*--page-server* / *--stream*). Hole-punching deduplication is
skipped for compressed images since compressed pages are
variably-sized.

*--compress-acceleration* 'N'::
Set the LZ4 acceleration level for page compression (1 to 65537).
Controls how thoroughly the compressor searches for matching byte
sequences. The default value of 1 gives the best compression
ratio. Higher values skip more match candidates, resulting in
faster compression but larger output. Decompression speed is not
affected. Implies *--compress* unless *--compress-region* is set.

*--decompress-threads* 'N'::
Set worker concurrency for LZ4 decoding and eligible large zero fills,
including the calling restore thread. The default value of 1 keeps each
LZ4 decode serial and handles zero blocks without a worker pool;
independent private, shmem, and memfd requests can still run concurrently.
A value of 0 lets CRIU choose the concurrency for each batch. CRIU starts
with the CPUs allowed by its affinity mask, then limits the width by the
number and decoded size of the blocks in that batch and by the restore-wide
CPU budget. Small batches and zero runs with fewer than two blocks remain
serial. Values above 1 set an upper bound on aggregate worker concurrency
instead of using the automatic CPU count. Explicit requests above the
available CPU count are reduced with a warning. The accepted range is 0
through 1024; this validation ceiling does not determine the automatic
concurrency.
Encoded staging memory is bounded independently of the thread count.
Restore keeps at most two active 32 MiB encoded input buffers. When a
local reader can reserve a second buffer without waiting, its calling thread
reads the next payload while pool workers decode the current one. If
another restore request already owns the second buffer, reading remains
synchronous. The option can also be set through a configuration file
(*decompress-threads 0*).

*--timeout* 'number'::
Set a time limit in seconds for collecting tasks during the
dump operation. The timeout is 10 seconds by default.
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ else
export CONFIG_COMPAT := y
export CONFIG_GNUTLS := y
export CONFIG_HAS_LIBBPF := y
export CONFIG_LZ4 := y
endif

#
Expand Down Expand Up @@ -462,10 +463,13 @@ ruff:
test/others/criu-ns/run.py \
crit/*.py \
crit/crit/*.py \
test/others/crit/*.py \
scripts/uninstall_module.py \
coredump/ coredump/coredump \
scripts/github-indent-warnings.py \
contrib/criu-service-client/test/*.py
contrib/criu-service-client/test/*.py \
contrib/compression-benchmark/ \
test/others/compression/

shellcheck:
shellcheck --version
Expand All @@ -478,6 +482,7 @@ shellcheck:
shellcheck -x test/others/config-file/*.sh
shellcheck -x test/others/action-script/*.sh
shellcheck -x contrib/criu-service-client/test/*.sh
shellcheck -x test/others/compression/*/*.sh

codespell:
codespell
Expand Down
8 changes: 8 additions & 0 deletions Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ else
$(info $S Install gnutls-devel (RPM) or gnutls-dev (DEB) to fix.)
endif

ifeq ($(NO_LZ4)x$(call pkg-config-check,liblz4),xy)
LIBS_FEATURES += -llz4
export CONFIG_LZ4 := y
FEATURE_DEFINES += -DCONFIG_LZ4
else
$(info Note: Building without LZ4 compression support.)
endif

ifeq ($(call pkg-config-check,libnftables),y)
LIB_NFTABLES := $(shell $(PKG_CONFIG) --libs libnftables)
ifeq ($(call try-cc,$(FEATURE_TEST_NFTABLES_LIB_API_0),$(LIB_NFTABLES)),true)
Expand Down
Loading
Loading