Shared Memory, Shared Page Tables: The Promise of Linux mshare
Introduction
In Linux, processes can share memory regions for inter‑process communication or data pooling. However, each process nearly always maintains its own set of page tables—even for memory that is identical across many processes. When a large number of processes share the same physical memory, the combined size of their page tables can actually exceed the size of the shared memory itself. This overhead has spurred long‑standing interest in allowing unrelated processes to share not just the memory, but also the page tables that map it. The latest effort, known as mshare, is being driven by Anthony Yznaga. He presented the current status of this work during the memory‑management track of the 2026 Linux Storage, Filesystem, Memory Management, and BPF Summit (LSFMM+BPF).
The Overhead of Traditional Shared Memory
Per‑Process Page Tables and Their Cost
Every process in Linux has its own virtual address space, managed by a hierarchy of page tables. When memory is shared—for example via mmap with MAP_SHARED or through System V shared memory—the physical pages are the same, but each process still builds its own page table entries (PTEs) for those pages. For a shared region of, say, 1 GB, each participating process adds about 2 MB of page table overhead (assuming 4 KB pages). With hundreds or thousands of processes, the aggregate page table memory can balloon into gigabytes, dwarfing the actual shared data.
When Sharing Becomes a Burden
This situation is especially painful in workloads that rely on massive shared memory pools:
- Database servers with large buffer pools accessed by many connections.
- Virtual machine (VM) hosts where guest memory is shared via KSM (Kernel Same‑page Merging).
- High‑performance computing (HPC) applications with shared data structures across many MPI ranks.
- Containerized environments where multiple containers map the same binaries or libraries.
In each case, the page table overhead not only consumes precious memory but also increases TLB (translation lookaside buffer) pressure and can degrade performance.
The mshare Solution: Sharing Page Tables
How mshare Differs from Existing Approaches
Existing mechanisms like KSM merge identical physical pages across processes, but they keep per‑process page table entries. That still leaves the page table overhead largely untouched. Other techniques, such as huge pages, reduce the number of PTEs but don't eliminate duplication when multiple processes map the same huge page.
mshare tackles the problem at the root: it enables unrelated processes to share the same page table structures for a given shared memory region. Instead of each process maintaining its own copy of the page table hierarchy for that region, they all point to a single shared set of page tables. This directly eliminates the redundant page table memory and can also reduce TLB misses because the same page table entries are cached in a unified way.
Historical Attempts and Current Progress
The idea of sharing page tables is not new. Earlier proposals—such as the Vortext work or the ksm‑based shared page tables patches—explored similar concepts but never matured into the mainline kernel. Anthony Yznaga’s mshare patch set builds on those lessons and aims to provide a clean, general‑purpose mechanism. At LSFMM+BPF 2026, Yznaga described the current implementation status:
- A new mapping type (or an extended
mmapflag) that tells the kernel to share page tables for a given VMA. - Support for private and shared mappings, with appropriate copy‑on‑write semantics.
- Integration with page fault handling so that faults in one process can be resolved using the shared page tables of another.
- Considerations for NUMA systems and memory migration.
The presentation also highlighted remaining challenges—particularly synchronising page table modifications and ensuring proper reference counting.
Potential Benefits and Challenges
Performance Implications
If mshare reaches mainline, the benefits could be significant:
- Memory savings: For 10,000 processes sharing a 1 GB region, page table overhead drops from ~20 GB to a few megabytes (just one copy of the page tables).
- Faster fork/exec: When creating new processes that inherit shared memory, the kernel can simply reference the shared page tables instead of copying them.
- TLB consolidation: All processes using the same page tables will hit the same TLB entries (on hardware that supports shared TLB entries across address spaces), reducing miss rates.
Security and Isolation Concerns
Sharing page tables between unrelated processes raises important security questions. If one process modifies a page table entry (e.g., to change permissions or to unmap a page), that change instantly affects all sharing processes. The kernel must enforce strict permission checks and ensure that only trusted processes can attach to a shared page‑table domain. Yznaga’s design includes capability‑based controls and namespace awareness to prevent accidental or malicious interference. Additionally, memory types like IOMMU and VMA locking need careful handling.
The 2026 LSFMM+BPF Presentation
During the memory‑management session, Yznaga walked through the current patch series (which was at version 6 at the time) and collected feedback from kernel developers. Key points raised in the discussion included:
- Scalability of the shared page‑table data structures under concurrent accesses.
- Interaction with KSM and transparent huge pages (THP).
- User‑space interface: whether a new system call is needed or an
mmapflag suffices. - Testing on real‑world workloads like Redis clusters and VM memory‑sharing setups.
While no final decision was made, the general sentiment was positive, with several developers expressing interest in further collaboration.
Conclusion
mshare represents a promising step toward eliminating a long‑standing source of memory waste in Linux. By allowing unrelated processes to share page tables for common memory regions, it could dramatically reduce overhead in large‑scale shared‑memory environments. Anthony Yznaga’s work has brought the concept closer to reality, and the feedback from LSFMM+BPF 2026 will help refine the implementation. If mshare is eventually merged, it will be a valuable tool for systems administrators and application developers seeking to maximise memory efficiency in multi‑process workloads.
Related Articles
- Exploring the Enhanced NTFS Driver in Linux Kernel 7.1-rc2: Key Updates and Performance Gains
- How to Use Firefox's Free VPN with Server Location Choice
- AMD's HDMI 2.1 FRL Patches for Linux: What You Need to Know
- How Meta Uses AI Agents to Boost Hyperscale Efficiency: Q&A
- Let-Go: A Fast, Embeddable Clojure-Like Language Built on Go
- Meta's AI Agents Revolutionize Hyperscale Efficiency: Hundreds of Megawatts Recovered
- Building a Self-Sustaining Efficiency Engine: A Hyperscale Guide to AI-Powered Performance Optimization
- Fedora Asahi Remix 44 Launches for Apple Silicon: Drops Custom Graphics Stack, Embraces Upstream Mesa