What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
To enable zswap on Ubuntu, first make sure the system has an active swap file or partition, then check whether the running kernel exposes /sys/module/zswap/parameters/enabled. For a one-time test, run sudo sh -c 'echo 1 > /sys/module/zswap/parameters/enabled'. To keep zswap enabled after reboot, add zswap.enabled=1 to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub, run sudo update-grub, and reboot. Verify both the kernel command line and the live sysfs value afterward.
What zswap does—and what it does not do
zswap is a compressed RAM cache for memory pages that the Linux kernel is preparing to write to swap. Instead of immediately writing every page to a swap device, the kernel compresses eligible pages and keeps them in a pool in physical RAM. If that pool fills or a page cannot be retained, the page can be written to the configured backing swap device.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Because zswap sits in front of swap, it is not a replacement for a swap file or partition. An Ubuntu installation with no active swap has nowhere for zswap to write pages that leave the compressed pool. Compression also consumes CPU time, so zswap is not automatically faster on every workload. The useful question is whether reducing swap-device I/O and retaining more pages in RAM helps your particular system.
Before enabling zswap
Confirm that swap is active
Open a terminal and run:
swapon --show
free -h
swapon --show should list a swap file or partition. The free -h output gives a human-readable view of total, used and available memory, including swap.
#1 Best Overall
- Capacity – 32GB RAM KIT (2 x 16GB Modules) Speed up to 2666MHz Non-ECC Unbuffered 288-Pin 1.2V UDIMM.
- Specs – Black PCB Color and Dual Rank (2Rx8).
- Compatibility – Designed for selected DDR4 Desktop PCs and workstations that support 288-Pin UDIMM memory. NOT compatible with Laptop SODIMM slots.
- Installation – Plug-and-Play Upgrade, Quick and Easy to Install, no expertise required (please refer to your system's manual for guidelines).
- Warranty – All Timetec products are high-quality and rigorously tested to meet stringent standards. Backed by Timetec Limited Lifetime Warranty and professional technical support based in the United States.
If swapon --show prints only its header, configure and activate swap before working on zswap. The exact swap-creation procedure depends on whether you want a swap file or partition; zswap cannot provide backing storage by itself.
Record the Ubuntu and kernel versions
Ubuntu release, architecture, HWE kernel and vendor kernel configuration can change zswap defaults and available parameters. Record the running kernel before changing anything:
Recommended Free Tools
cat /etc/os-release
uname -r
uname -m
Keep this information with any troubleshooting report. Two machines both described as “Ubuntu” may expose different compressors, pool controls or default behavior.
Check whether zswap is available and already enabled
zswap is commonly built into Ubuntu kernels rather than installed as a separate package. The authoritative test is the interface exported by the running kernel, not the presence of an apt package. Inspect it with:
ls -l /sys/module/zswap/parameters/
cat /sys/module/zswap/parameters/enabled 2>/dev/null || true
cat /proc/cmdline
If the parameter directory exists, the running kernel has a zswap interface. The enabled file normally reports Y or 1 when active and N or 0 when inactive; use the value your kernel prints as the source of truth. If the file does not exist, that kernel does not expose zswap through this interface, so do not assume a boot parameter will work.
/proc/cmdline shows the options used to boot the current kernel. Finding zswap.enabled=1 there confirms that the bootloader requested zswap, but still check the sysfs value because the running kernel state is what matters. Conversely, a kernel can start with zswap enabled by its build-time default even when no zswap.enabled=1 option appears on the command line.
Enable zswap temporarily for the current boot
A runtime change is useful for testing because it does not modify the bootloader configuration. It lasts only until the next reboot.
- Check the current state:
cat /sys/module/zswap/parameters/enabled - Enable the feature as root:
sudo sh -c 'echo 1 > /sys/module/zswap/parameters/enabled' - Read the value back:
cat /sys/module/zswap/parameters/enabled
The Linux kernel documentation specifies the runtime interface as echo 1 > /sys/module/zswap/parameters/enabled. Writing through sudo sh -c is important: placing sudo before echo alone would leave the redirection running as your unprivileged shell.
Rank #2
- Boosts System Performance: 16GB DDR4 Pro Series desktop memory RAM kit (2x8GB) that operates at 3200MHz, 3000MHz, or 2666MHz to improve multitasking and system responsiveness for smoother performance
- Easy Installation: Upgrade your desktop RAM with ease—no computer skills required Follow step-by-step how-to guides available at Crucial for a smooth, worry-free installation
- Compatibility Guaranteed: Ensure seamless compatibility with your desktop by using the Crucial System Scanner or Crucial Upgrade Selector—get accurate recommendations for your specific device
- Trusted Micron Quality: Backed by 42 years of memory expertise, this DDR4 RAM is rigorously tested at both component and module levels, ensuring top performance and reliability
- ECC Type = Non-ECC, Form Factor = UDIMM, Pin Count = 288-pin, PC Speed = PC4-25600, Voltage = 1.2V, Rank and Configuration = 1Rx16, 1Rx8 or 2Rx8
If the write fails, capture the exact error and inspect the parameter directory again. A missing file, a read-only parameter or a kernel that does not permit changing the state at runtime requires a boot-time configuration or a different kernel; do not force the write with an unrelated command.
Enable zswap permanently with GRUB
Edit the kernel command line
Open the GRUB defaults file with an editor:
sudo nano /etc/default/grub
Find the existing GRUB_CMDLINE_LINUX_DEFAULT line and append zswap.enabled=1 inside its quotation marks. Preserve every option already present. For example:
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallGRUB_CMDLINE_LINUX_DEFAULT="quiet splash zswap.enabled=1"
Do not replace the whole line if your machine has other required options. If the line already contains parameters, add a space followed by zswap.enabled=1 before the closing quote.
Regenerate GRUB and reboot
- Save the file and run:
sudo update-grub - Watch for errors in the generated configuration. If the command reports a syntax problem, fix
/etc/default/grubbefore rebooting. - Reboot:
sudo reboot
The option is persistent because GRUB passes it to every subsequent boot until you remove it. A kernel update may select a different kernel build, so verify the live state after updates rather than relying only on the text file.
Verify zswap after reboot
After logging in again, check both the command line and the kernel parameter:
cat /proc/cmdline
cat /sys/module/zswap/parameters/enabled
The first command should include zswap.enabled=1. The second should show the enabled value used by your kernel. If the command line contains the option but the sysfs value remains disabled, inspect the parameter files and the kernel configuration; the boot request was received, but the feature did not become active.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Also confirm that swap is still available:
swapon --show
free -h
zswap can be enabled while swap is configured incorrectly, so this check separates a zswap problem from a missing or inactive backing device.
Check whether zswap is actually being used
An enabled flag proves only that the feature is on. It does not prove that pages have been compressed or that the pool is saving swap-device writes.
Rank #3
- Capacity – 32GB RAM KIT (2 x 16GB Modules) Speed up to 2400MHz Non-ECC Unbuffered 288-Pin 1.2V UDIMM.
- Specs – Black PCB Color and Dual Rank (2Rx8).
- Compatibility – Designed for selected DDR4 Desktop PCs and workstations that support 288-Pin UDIMM memory. NOT compatible with Laptop SODIMM slots.
- Installation – Plug-and-Play Upgrade, Quick and Easy to Install, no expertise required (please refer to your system's manual for guidelines).
- Warranty – All Timetec products are high-quality and rigorously tested to meet stringent standards. Backed by Timetec Limited Lifetime Warranty and professional technical support based in the United States.
Inspect exposed parameters
Read the controls your kernel makes available:
cat /sys/module/zswap/parameters/max_pool_percent 2>/dev/null || true
cat /sys/module/zswap/parameters/compressor 2>/dev/null || true
cat /sys/module/zswap/parameters/accept_threshold_percent 2>/dev/null || true
These files may be absent on a particular Ubuntu kernel. Absence is a version or configuration difference, not a value you should invent.
Read debugfs statistics when available
Some kernels expose zswap counters through debugfs. If the relevant files are missing, mount debugfs first:
mount | grep debugfs
sudo mount -t debugfs none /sys/kernel/debug
Then inspect the zswap statistics directory if present:
find /sys/kernel/debug -maxdepth 3 -type f -iname '*zswap*' -o -path '*/zswap/*'
On kernels that provide them, counters for stored pages, pool size and related events show activity over time. Generate representative memory pressure on your normal workload and compare the counters before and after. Counter names and paths are kernel-dependent, so use the files that actually exist instead of copying a layout from another release.
Tune zswap only after measuring
Start with only zswap.enabled=1. Ubuntu kernel builds do not share one universal compressor, zpool implementation or default setting, and an option accepted by one kernel may be unavailable on another.
Understand max_pool_percent
max_pool_percent limits the compressed pool as a percentage of physical RAM. It is not a percentage of the swap file or partition, and it is not a promise that the pool will consume that amount. For example, a value of 25 means the pool may use up to the configured fraction of system RAM, subject to kernel behavior and compression results.
If you choose to set a cap, add it as a boot option only after confirming that the live kernel exposes the parameter:
zswap.max_pool_percent=25
There is no Ubuntu-wide value that is safe for every workload. A larger possible pool can retain more compressed pages but also reserves more RAM for zswap; a smaller cap leaves more RAM for applications but may cause earlier writeback to the swap device.
Rank #4
- Boosts System Performance: 64GB DDR4 desktop memory RAM kit (2x32GB) that operates at 3200MHz, 2933MHz, or 2666MHz to improve multitasking and system responsiveness for smoother performance
- Easy Installation: Upgrade your desktop RAM with ease—no computer skills required Follow step-by-step how-to guides available at Crucial for a smooth, worry-free installation
- Compatibility Guaranteed: Ensure seamless compatibility with your desktop by using the Crucial System Scanner or Crucial Upgrade Selector—get accurate recommendations for your specific device
- Trusted Micron Quality: Backed by 42 years of memory expertise, this DDR4 RAM is rigorously tested at both component and module levels, ensuring top performance and reliability
- ECC Type = Non-ECC, Form Factor = UDIMM, Pin Count = 288-pin, PC Speed = PC4-25600, Voltage = 1.2V, Rank and Configuration = 2Rx8
Choose a compressor only when the kernel supports it
The compressor parameter selects the algorithm used for zswap pages. List or read the value exposed by the running kernel:
cat /sys/module/zswap/parameters/compressor 2>/dev/null || true
Available algorithms and defaults depend on kernel configuration. Do not copy a compressor name from a different Ubuntu release without checking that your kernel accepts it. Compression speed, memory savings and CPU overhead vary by algorithm and by the data being compressed.
Use accept_threshold_percent carefully
The acceptance threshold controls when zswap stops accepting pages as the pool approaches its limit, creating hysteresis instead of constantly switching at one boundary. Read the live value first:
cat /sys/module/zswap/parameters/accept_threshold_percent 2>/dev/null || true
Change it only when you understand the resulting pool behavior and have a way to compare statistics under your workload. Most systems should begin with the kernel default.
Apply additional options persistently
When supported, multiple options can be placed on the same GRUB line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=<supported-name>"
Replace <supported-name> with a compressor name confirmed on your machine; do not use the angle-bracket text literally. After editing, run sudo update-grub, reboot, and recheck every parameter. If a new option causes a boot problem or is rejected, remove it from GRUB and regenerate the configuration.
Free tools Windows power users keep installed
One-click scans. No signup required.
Per-service controls with systemd
Recent systemd versions expose MemoryZSwapMax= and MemoryZSwapWriteback= for services and other cgroups. These settings can limit a unit’s zswap use or control whether compressed pages may be written back to the backing device.
They do not enable zswap globally. First enable and verify the kernel feature, then use the cgroup properties when you have a specific service-policy requirement. Availability and exact behavior depend on the systemd version and the active kernel’s memory-controller support.
Best Value
- Actual memory speed may vary depending on the system, CPU, motherboard, BIOS settings, and supported memory configuration. DDR4 3200MHz modules may operate at lower speeds such as 2933MHz or 2666MHz when supported by the host system. Please check your device specifications and compatibility before purchase.
- Adherence to JEDEC and compliance to RoHS with respect to environmental protection regulation, production and manufacturing
- All new generation product of DRAM module. Strict test and verification procedures are performed for products
- Lifetime warranty and Free technical support
- ※ Refer to the latest version on the official website. In case of discrepancies, the official website prevails.
Troubleshooting common failures
The parameter directory does not exist
If /sys/module/zswap/parameters/ is absent, the running kernel may not include zswap or may expose it differently. Check uname -r, booted-kernel configuration and available Ubuntu kernel packages. Do not treat installing a random package as proof that the currently running kernel supports the feature.
zswap.enabled=1 is in /proc/cmdline, but zswap is off
Read the sysfs value and list all parameters. A vendor or HWE kernel can differ from the kernel on which a guide was written. Check for boot errors, confirm that the option is spelled exactly, and test with only zswap.enabled=1 before adding tuning options.
The runtime command says permission denied
Use the shell-redirection form exactly:
sudo sh -c 'echo 1 > /sys/module/zswap/parameters/enabled'
If it still fails, the parameter may be read-only or the kernel may not support changing it after initialization. Use the persistent GRUB method if the kernel supports boot-time activation.
zswap is enabled but swap usage does not change
zswap is demand-driven. A lightly loaded system may have no pages to compress, and incompressible pages may go directly to backing swap. Check debugfs counters where available and test under a repeatable memory workload instead of judging from the enabled flag alone.
The system becomes slower
Compression adds CPU work. Compare application latency, CPU utilization, swap-device I/O and memory pressure with zswap enabled and disabled under the same workload. If CPU cost outweighs reduced I/O, remove extra compressor or pool settings first, then disable zswap and reassess the swap configuration.
zswap, zram and ordinary swap compared
| Characteristic | zswap | zram swap | Ordinary swap |
|---|---|---|---|
| Where compressed data lives | Compressed pool in RAM, with overflow/writeback to a backing swap device | Compressed RAM block device used as swap | Typically an uncompressed swap file or partition on storage |
| Backing swap required | Yes | Not necessarily; zram itself can provide the swap device | Yes, the swap device is the storage |
| Compression CPU cost | Yes; depends on compressor and workload | Yes; depends on compressor and workload | Usually no compression cost unless another layer is used |
| Writeback behavior | Pages can be written from the compressed pool to backing swap | Normally remains in the RAM-backed compressed device unless another swap layer exists | Pages are written directly to the swap device |
| Observability | Sysfs parameters and, on some kernels, debugfs counters | zram device statistics and standard swap reporting | Standard swap reporting and storage metrics |
| Per-cgroup policy | Recent systemd versions provide MemoryZSwapMax= and MemoryZSwapWriteback= |
Policy is generally managed through the device and cgroup memory controls | Managed through ordinary memory and swap controls |
These designs solve different bottlenecks. zswap is appropriate when you want a compressed front end while retaining a conventional swap device. zram emphasizes compressed RAM and can operate without disk-backed swap. Ordinary swap avoids compression overhead but depends directly on storage latency. None is universally faster; measure the workload that matters.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsHow to roll zswap back safely
Temporary rollback
To disable zswap until the next reboot:
sudo sh -c 'echo 0 > /sys/module/zswap/parameters/enabled'
Read the parameter afterward to confirm the requested state.
Persistent rollback
- Edit the GRUB defaults file:
sudo nano /etc/default/grub - Remove every
zswap.*option you added, includingzswap.enabled=1and any pool or compressor settings. - Regenerate the boot configuration:
sudo update-grub - Reboot and verify that the command line and sysfs value now reflect the disabled configuration.
Disabling zswap does not necessarily flush every page immediately. Kernel documentation states that pages already held in the compressed pool remain until they are invalidated or faulted back; swapoff forces pages out of the compressed pool. Do not run swapoff casually on a memory-constrained system: it may require enough free RAM to bring swapped pages back.
What to include in a support report
When asking for help, include the Ubuntu release, architecture, uname -r output, swapon --show, the contents of /proc/cmdline, and the values of the zswap parameters that exist on your machine. State whether the change was made at runtime or through GRUB, and include the exact error from any failed command. This distinguishes a missing backing swap device, an unsupported kernel interface, a bootloader mistake and a workload that simply has not generated zswap activity.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.

