Forge Home

ksm

Manages Linux Kernel Samepage Merging (KSM)

10,516 downloads

10,516 latest version

3.9 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 0.0.1 (latest)
released Oct 10th 2013

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'jhoblitt-ksm', '0.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add jhoblitt-ksm
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install jhoblitt-ksm --version 0.0.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

jhoblitt/ksm — version 0.0.1 Oct 10th 2013

Puppet ksm Module

Build Status

Table of Contents

  1. Overview
  2. Description
  3. Words of Caution
  4. Usage
  5. Limitations
  6. Support
  7. See Also

Overview

Manages Linux Kernel Samepage Merging (KSM)

Description

This is a puppet module for configuration of the ksm and ksmtuned services that in turn manage Linux's Kernel Samepage Merging (KSM) functionality. The KSM subsystem has broad applicability but is typically used on hosts acting as hypervisor for KVM virtual machines.

The typical mode of operation is that the ksmtuned service starts and stops the ksm service based configurable heuristics. At present, this is the only configuration supported by this module.

Words of Caution

Documentation on the configuration of ksmtuned is sparse. There is section in RHEL6 Virtualization Administration Guide but it doesn't provide much help and at least the description of pages_to_scan is incorrect.

There is a much more useful explanation in the RHEL6 Solutions site but it is only accessible to customer paying for RHEL support.

Be advised that:

  • KSM consumes both CPU time (aka electricity) and memory bandwidth.
  • Under at least Linux 2.6.32/RHEL6 KSM merged pages that have been swapped out are unshared when swapped back in. I suspect I've seen this exacerbate "swap hell" caused by not adjusting vm.swappiness from the default on large memory hosts.

Usage

Simple

The defaults are probably acceptable for most use cases.

include ksm

or

class { 'ksm': }

Advanced

This example:

  • Disables the default 50% of memory shared page limit (KSM_MAX_KERNEL_PAGES)
  • Changes the interval that ksmtuned wakes up at from 60s -> 15s
  • Changes the default 'free' memory threshold from 20% to 25%
  • Changes the default number of pages scanned per KSM cycle (typically 10msec) from 1250 -> 256
class { 'ksm':
  ksm_config      => {
    'KSM_MAX_KERNEL_PAGES' => 0,
  },
  ksmtuned_config => {
    'KSM_MONITOR_INTERVAL' => 15,
    'KSM_THRES_COEF'       => 25,
    'KSM_NPAGES_MAX'       => 256
  },
}

Files

The ksmtuned debugging log is enabled at the path /var/log/ksmtuned with logrotate support.

ksm

# defaults
class { 'ksm':
  ksm_config      => {},
  ksmtuned_config => {},
}
  • ksm_config

    Hash

    Options to be set in /etc/sysconfig/ksm

    Valid Keys are:

    • KSM_MAX_KERNEL_PAGES

      defaults to: {}

  • ksmtuned_config

    Hash

    Options to be set in /etc/ksmtuned.conf

    Valid Keys are:

    • KSM_MONITOR_INTERVAL

    • KSM_SLEEP_MSEC

    • KSM_NPAGES_BOOST

    • KSM_NPAGES_DECAY

    • KSM_NPAGES_MIN

    • KSM_NPAGES_MAX

    • KSM_THRES_COEF

    • KSM_THRES_CONST

      defaults to: {}

Limitations

At present, only support for $::osfamily == 'RedHat' has been implemented.

Tested Platforms

  • el6.x

Support

Please log tickets and issues at github

See Also