Pcornel
Browse topics
Options
Recent
Favorites
Virtualization · Technical reference

Memory Sharing

Direct answer

Memory sharing (Transparent Page Sharing on ESXi, KSM on KVM) deduplicates identical memory pages across VMs. It saves RAM for similar guests but is limited by default today because of side-channel security concerns.

When to use this

Use this when evaluating memory deduplication (TPS, KSM) and its security trade-offs.

First 30 seconds

1. Memory sharing (KSM, TPS) merges identical pages.

2. Saves memory for similar guests.

3. Costs CPU; side-channel concerns (inter-VM sharing off by default on ESXi).

4. Monitor savings.

5. Disable if not useful.

Operational verification

identical pages → merged → copy on write

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • Enabling KSM on hosts with sensitive multi-tenant workloads.
  • Expecting large savings with large pages enabled.
  • Ignoring the CPU cost of scanning on busy hosts.
Platform / version applicability
virtualization-hardware
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformvirtualization-hardware
Key commandesxtop → m → SHRD, ZERO columns
Scope / prerequisiteUse this when evaluating memory deduplication (TPS, KSM) and its security trade-offs.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

1 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Checks Verify boundary
cat /sys/kernel/mm/ksm/run              # 1 = KSM active
cat /sys/kernel/mm/ksm/pages_sharing
esxtop → m → SHRD, ZERO columns

High pages_sharing means real savings. On Proxmox, KSM (ksmtuned) starts sharing when host memory use passes a threshold (80 % by default).

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Sharing saves RAM for similar guests.
  • Inter-VM sharing is limited for security.
  • Large pages reduce sharing.
Key checks
  • cat /sys/kernel/mm/ksm/pages_sharing — KSM shared pages
  • systemctl status ksmtuned — KSM tuner
  • esxtop — SHRD (TPS)
ReferenceWhy it matters1 section · depth on demand

Trade-offs

  • Saves memory when many similar VMs run (same OS, VDI).
  • Costs CPU for scanning pages.
  • Side-channel risk: since 2014 ESXi shares pages only within a VM by default (salting); KSM on KVM is often disabled on multi-tenant hosts.
  • Large pages (2 MB) reduce sharing until the host is under pressure and breaks them into small pages.
ReferenceImportant terms & boundaries1 section · depth on demand

In depth

Memory sharing deduplicates identical memory pages across VMs: KSM on KVM, Transparent Page Sharing (TPS) on VMware. Savings are largest with many similar VMs (VDI, identical Linux guests).

Security: page sharing can enable side-channel attacks between VMs, so VMware disables inter-VM TPS by default (salting) and large pages reduce sharing opportunities further. KSM costs CPU for scanning.

cat /sys/kernel/mm/ksm/pages_sharing      # pages saved
systemctl status ksmtuned
ReferenceConfiguration & state1 section · depth on demand
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docvirtualization-hardware current

Authoritative/upstream documentation reviewed for bounded claims in Memory Virtualization → Memory Sharing. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://libvirt.org/docs.html · confidence 94%
Confirmation

Confirm action

Continue?