Kernel Same Page Merging Latency Reduction via Deferred Deduplication

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Kernel same page merging (KSM) introduces significant latency due to the overhead of copying memory pages when guests attempt to write to shared pages, and existing solutions like memory swapping increase CPU usage and I/O latency, especially during memory pressure events.

Innovation Solution

A system and method where duplicate memory pages are write-protected and added to a list, with pages removed only when memory pressure is detected, allowing writes without copying until necessary, thereby reducing latency and improving system performance.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If memory pages are copied when guests attempt to write to shared pages, then write access is enabled, but latency increases significantly

Engineering Contradiction:
Improvewrite access capabilityVSAvoidlatency
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system performs preliminary actions by identifying and write-protecting duplicate pages in advance, adding them to a list for deferred de-duplication. This allows the system to prepare for potential writes without immediately copying pages, thereby reducing latency while maintaining write access capability when needed.

Inventive Principle:
Principle #10Preliminary action

2Quantity of substance

If memory swapping is used to manage memory pressure, then memory capacity is increased, but CPU usage and I/O latency increase

Engineering Contradiction:
Improvememory capacityVSAvoidCPU usage
Core Design Contradiction:
Quantity of substanceVSUse of energy by moving object

Solution Approach 1:

The invention extracts the de-duplication operation from the immediate write path and defers it to a later time when memory pressure events occur. By removing the copying operation from the critical write path and handling it separately during memory pressure events, the system reduces CPU usage and I/O latency while still managing memory capacity effectively.

Inventive Principle:
Principle #2Taking out (Extraction)

3Quantity of substance

If duplicate pages are immediately de-duplicated, then memory usage is optimized, but system responsiveness decreases

Engineering Contradiction:
Improvememory usage efficiencyVSAvoidsystem responsiveness
Core Design Contradiction:
Quantity of substanceVSSpeed

Solution Approach 1:

The system dynamically adjusts the de-duplication timing based on memory pressure events. Instead of immediately de-duplicating pages, the system maintains duplicate pages in a list and only performs de-duplication when memory pressure events occur, thereby optimizing memory usage efficiency while preserving system responsiveness during normal operation.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS11734182B2Latency reduction for kernel same page merging
Publication Date: 2023.08.22 RED HAT LLC
  • US11734182B2 patent drawing
  • US11734182B2 patent drawing
  • US11734182B2 patent drawing

AI summary

A system includes a memory including a plurality of memory pages, a processor in communication with the memory, and a supervisor. The supervisor is configured to locate at least two duplicate memory pages of the plurality of memory pages, write-protect the at least two duplicate memory pages, and add the at least two duplicate memory pages to a list. Responsive to a first page of the at least two duplicate memory pages changing, the supervisor is configured to remove the first page from the list. Responsive to a memory pressure-triggering event, the supervisor is configured to remove a second page of the at least two duplicate memory pages from the list. The second page is reused after removal from the list.