KernelDedup

Feed Rss

Introduction

Linux kernel has a feature named KSM(Kernel SamePage Merging). it lets the hypervisor system share identical memory pages amongst different processes or virtualized guests. However, it has its limitation such like high CPU usage and slow responses to workload change. So here comes UKSM. With a revolutionary algorithm redesign, UKSM has many advanced features:

  • Full system scan. It automatically scans all user processes’ anonymous VMAs. Before UKSM, a process need to call KSM kernel API to submit its memory areas to KSM for scan. This makes many legacy software other than KVM can NOT benefit from KSM. Now, UKSM scans whole system applications including KVM. All programs benefit from UKSM without even knowing how it works.
  • Super quiet CPU usage. It automatically detects rich areas containing abundant duplicated pages. Rich areas are given a full scan speed. Poor areas are sampled at a reasonable speed with very low CPU consumption usually under 1%. Our benchmarks show that even for CPU intensive workloads, it has a negligible performance impact.
  • Ultra scan speed and CPU efficiency. A new hash algorithm is proposed. As a result, on a machine withCore(TM)2 Quad Q9300 CPU in 32-bit mode and 800MHZ DDR2 main memory, it can scan memory areas that does not contain duplicated pages at speed of 627MB/sec ~ 2445MB/sec and can merge duplicated areas at speed of 477MB/sec ~ 923MB/sec. For a bunch of busy workloads creating lots of duplicated pages, this means, with UKSM, you no long suffer from deadly swapping which is observed in KSM enabled setting.
  • Thrashing area avoidance. If a VM is constantly writing the same data to the duplicated pages, KSM suffer a problem of thrashing, i.e. the pages it merges will soon get copied again. In this situation, the CPU is purely wasted without having much memory saving. UKSM can perfectly avoid this situation by detecting the thrashing areas.

In short, if you are managing a Linux server with lots of KVM virtual machines or containers(e.g. OpenVZ, LXC), UKSM is a must have feature! If you are desktop user, you also benefit a lot from it.

 

UKSM demo on desktop Linux