Kernel Samepage Merging (KSM) is a Linux feature that reduces physical memory use by sharing identical memory pages between opted-in applications. The kernel’s ksmd daemon scans eligible ranges; when it finds matching pages, it can replace them with one shared, write-protected page. If a process later changes that data, the kernel gives it a private copy.
What KSM merges—and what it leaves alone
KSM operates only on anonymous private pages: memory that is not backed by a file. It does not merge file page-cache pages, and it does not automatically scan all RAM. An application must mark a memory range as eligible using madvise(MADV_MERGEABLE). It can withdraw that advice with madvise(MADV_UNMERGEABLE). The Linux kernel documentation describes this scope in its Kernel Samepage Merging guide.
The feature was originally developed for KVM virtual machines, where separate guests may hold identical memory contents. It can also benefit other applications that generate repeated data, provided those applications designate suitable ranges.
How sharing works
- An application opts in. It marks a range as mergeable with
madvise(MADV_MERGEABLE). ksmdscans eligible memory. The kernel daemon looks for identical pages among the designated ranges.- Matching pages may be consolidated. Instead of keeping separate physical copies, the kernel can map the processes to one shared, write-protected page.
- A write creates a private copy. If a process attempts to change the shared contents, the kernel uses copy-on-write to give it its own page.
The kernel must be built with CONFIG_KSM=y for the feature to be available. An application’s mergeable-range registration can succeed even if ksmd is not running at that moment; the registered pages may be scanned if the daemon starts later.
#1 Best Overall
- Disclaimer: Maximum Speed requires overclocking/PC BIOS adjustments. Maximum speed and performance depend on system components, including motherboard and CPU
- Hand-sorted memory chips ensure high performance with generous overclocking headroom
- VENGEANCE LPX is optimized for wide compatibility with the latest Intel and AMD DDR4 motherboards
- A low-profile height of just 34mm ensures that VENGEANCE LPX even fits in most small-form-factor builds
- A solid aluminum heatspreader efficiently dissipates heat from each module so that they consistently run at high clock speeds
When KSM can help—and what it costs
KSM is useful only when opted-in ranges contain identical pages that can be shared. The amount of memory saved therefore depends on the application and workload; there is no general saving percentage that applies to every system.
Sharing also has costs. Scanning consumes CPU, and KSM uses reverse-mapping metadata to track scanned pages, which itself takes memory. The kernel’s KSM profitability guide describes an estimate for weighing potential savings against these costs. Treat it as a way to assess a particular system, not as a promise of a fixed benefit. Applications should limit MADV_MERGEABLE to ranges likely to benefit.
Rank #2
- Boosts System Performance: 32GB DDR5 RAM laptop memory kit (2x16GB) that operates at 5600MHz, 5200MHz, or 4800MHz to improve multitasking and system responsiveness for smoother performance
- Accelerated gaming performance: Every millisecond gained in fast-paced gameplay counts—power through heavy workloads and benefit from versatile downclocking and higher frame rates
- Optimized DDR5 compatibility: Best for 12th Gen Intel Core and AMD Ryzen 7000 Series processors — Intel XMP 3.0 and AMD EXPO also supported on the same RAM module
- Trusted Micron Quality: Backed by 42 years of memory expertise, this DDR5 RAM is rigorously tested at both component and module levels, ensuring top performance and reliability
- ECC Type = Non-ECC, Form Factor = SODIMM, Pin Count = 262-Pin, PC Speed = PC5-44800, Voltage = 1.1V, Rank And Configuration = 1Rx8
NUMA systems: sharing versus locality
On systems with non-uniform memory access (NUMA), allowing pages to be shared across nodes can increase deduplication, but may put a process’s memory farther from the CPU accessing it. Restricting merging to one node can preserve locality while reducing the pool of pages that can match. Which trade-off is preferable depends on the workload and machine; there is no universally best setting.
Quick Recap
Rank #3
- Disclaimer: Maximum Speed requires overclocking/PC BIOS adjustments. Maximum speed and performance depend on system components, including motherboard and CPU
- AMD EXPO & Intel XMP 3.0 Compatible Only: Dual memory profiles allow you to easily select optimized settings for your platform, whether you’re running an AMD or Intel processor
- Dynamic RGB Lighting: Individually addressable RGB lighting delivers vibrant effects through a sleek, understated panoramic diffuser
- Onboard Voltage Regulation: Onboard voltage regulation for reliable power at high frequencies
- Maximum Bandwidth and Tight Response Times: Optimized for peak performance on the latest AMD and Intel DDR5 motherboards
How to decide whether KSM fits
- Check whether the application marks ranges as mergeable and whether those ranges are likely to contain duplicate data.
- Use the running kernel’s KSM counters and profitability estimate to compare memory savings with scanner CPU use and metadata overhead.
- On NUMA hardware, consider the effect of cross-node sharing on memory locality as well as the number of pages that can be merged.
- Consult the documentation for the running kernel before changing sysfs controls: available settings and defaults can vary by kernel version.
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.




