Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 635418 - Allow enable/disable ksm per VM
Allow enable/disable ksm per VM
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.1
All Linux
low Severity medium
: beta
: 6.1
Assigned To: Andrea Arcangeli
Virtualization Bugs
: FutureFeature
Depends On:
Blocks: 655920 580954 635417 LibvirtKSMOff 1008500
  Show dependency treegraph
 
Reported: 2010-09-19 12:12 EDT by Itamar Heim
Modified: 2013-09-16 09:35 EDT (History)
12 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.135.el6
Doc Type: Enhancement
Doc Text:
Previously, KSM supported global settings and no enable or disable options for each individual virtual machine. Qemu-kvn now allows selective decisions about whether or not KVM should register in KSM at the time of a virtual machine start up. This selection decision feature allows higher performance virtual machines to be selected from the manager, which eliminates the risk of the virtual machine slowing down due to memory duplication.
Story Points: ---
Clone Of:
: 769021 (view as bug list)
Environment:
Last Closed: 2011-05-19 07:30:34 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0534 normal SHIPPED_LIVE Important: qemu-kvm security, bug fix, and enhancement update 2011-05-19 07:20:36 EDT

  None (edit)
Description Itamar Heim 2010-09-19 12:12:06 EDT
- at create
- via monitor command
Comment 1 Andrea Arcangeli 2010-10-08 11:08:33 EDT
This is an useful feature and it shall be implemented in qemu userland. It doesn't require kernel support (madvise can be called also on a running qemu dynamically to remove it from KSM scan, via qemu monitor command).

The plan is to have KSM scanning subpages inside transparent hugepages, and to split the hugepage and merge the subpages in case we can merge equal subpages. So disabling KSM will prevent hugepages to be splitted so allowing for higher performance.
Comment 4 Andrea Arcangeli 2010-12-21 10:18:09 EST
This adds -redhat-disable-THP and -redhat-disable-KSM parameters to qemu-kvm.

https://brewweb.devel.redhat.com/taskinfo?taskID=2991515

This qemu-kvm package should be used in combination with this kernel that implements MADV_NOHUGEPAGE:

https://brewweb.devel.redhat.com/taskinfo?taskID=2979741
Comment 13 Joy Pu 2011-02-18 04:24:04 EST
Verify this bug in 
rpm -qa |grep qemu-kvm-0.12.1.2-2.136 and 2.6.32-94 kernel
gpxe-roms-qemu-0.9.7-6.3.el6.noarch
qemu-img-0.12.1.2-2.136.el6.x86_64
qemu-kvm-tools-0.12.1.2-2.136.el6.x86_64
qemu-kvm-debuginfo-0.12.1.2-2.136.el6.x86_64
qemu-kvm-0.12.1.2-2.136.el6.x86_64

with the -redhat-disable-KSM option, when dd in guest  /sys/kernel/mm/ksm/pages_sharing will be 0. And this value will change without this option.

Steps:
1. enable KSM
echo 1 > /sys/kernel/mm/ksm/
2. start two guest with -redhat-disable-KSM
3. swap off  in both guest
   swapoff -a
4. mount tmpfs and dd 2G zero file in guest
  mount -t tmpfs none /mnt
  dd if=/dev/zero of=/mnt/zero
5. cat /sys/kernel/mm/ksm/pages_sharing to check the status
Comment 14 Andrea Arcangeli 2011-05-06 14:40:16 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
A new feature has been introduced to qemu-kvm to selectively decide if KVM should register in KSM or not at virtual machine startup time. Previously it would register unconditionally so KSM could only enabled/disabled globally and not selectively for each virtual machine. This allows to select higher performance virtual machines from the manager, that will not risk to be slowed down in memory de-duplication (either because of transparent hugepage splits during memory-merging, or because of copy-on-writes when de-duplicated memory is modified by the guest).
Comment 15 Misha H. Ali 2011-05-12 02:48:01 EDT
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-A new feature has been introduced to qemu-kvm to selectively decide if KVM should register in KSM or not at virtual machine startup time. Previously it would register unconditionally so KSM could only enabled/disabled globally and not selectively for each virtual machine. This allows to select higher performance virtual machines from the manager, that will not risk to be slowed down in memory de-duplication (either because of transparent hugepage splits during memory-merging, or because of copy-on-writes when de-duplicated memory is modified by the guest).+Previously, KSM supported global settings and no enable or disable options for each individual virtual machine. Qemu-kvn now allows selective decisions about whether or not KVM should register in KSM at the time of a virtual machine start up. This selection decision feature allows higher performance virtual machines to be selected from the manager, which eliminates the risk of the virtual machine slowing down due to memory duplication.
Comment 16 errata-xmlrpc 2011-05-19 07:30:34 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html
Comment 17 errata-xmlrpc 2011-05-19 08:49:01 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html

Note You need to log in before you can comment on or make changes to this bug.