Bug 769021

Summary: Allow enable/disable ksm per VM
Product: Red Hat Enterprise Linux 7 Reporter: Daniel Berrangé <berrange>
Component: qemu-kvmAssignee: Luiz Capitulino <lcapitulino>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 7.0CC: amit.shah, areis, dallan, ehabkost, iheim, juzhang, knoel, lcapitulino, michen, mjenner, mkenneth, tburke, virt-maint, xfu, ypu
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: qemu 1.3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 635418
: 950968 (view as bug list) Environment:
Last Closed: 2014-06-13 10:36:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 580954, 635417, 635419, 655920, 950968, 1008500    

Comment 4 Luiz Capitulino 2012-06-26 13:06:13 UTC
RFC series has been posted upstream:

 http://lists.gnu.org/archive/html/qemu-devel/2012-06/msg04206.html

Discussion is going on, but there's general agreement on the feature. Except for the QMP command, which we've decided to drop because of lack of use-cases.

Comment 5 Luiz Capitulino 2012-09-11 12:51:18 UTC
Posted v5 a few days ago:

http://lists.gnu.org/archive/html/qemu-devel/2012-09/msg00547.html

This is very likely to be the final version. It's also important to note that the QMP command from the RFC series (comment 4) has been dropped. We're only going to have command-line support for this (-machine mem-merge=on|off).

Comment 6 Luiz Capitulino 2012-09-17 19:18:10 UTC
This has finally been merged upstream (commit 8490fc78).

Comment 7 FuXiangChun 2013-11-04 03:07:46 UTC
Verify this bug with qemu-kvm-1.5.3-10.el7.x86_64 and 3.10.0-37.el7.x86_64

steps:
Test Scenario-1

In host
1.echo 1 > /sys/kernel/mm/ksm/run
2.echo 50 > /sys/kernel/mm/ksm/sleep_millisecs
3.echo 5000 > /sys/kernel/mm/ksm/pages_to_scan
4.Boot two RHEL7.0 guests with "-machine mem-merge=on" 

In guest
1.swapoff -a(disable swap)
2.mount -f tmpfs none /mnt
3. dd if=/dev/zero of=/mnt/zero 

result:
This pages_sharing continues to rise(1444~1348592)
cat /sys/kernel/mm/ksm/pages_sharing
1348592

Test Scenario-2
Use the same test steps as Scenario1.
If booting two guests with -machine mem-merge=off.

result:
This pages_sharing is constant(no change)
cat /sys/kernel/mm/ksm/pages_sharing
1444

Test scanrio-3
Booting the first guest with -machine mem-merge=off
Booting the second guest with -machine mem-merge=on

result:
This pages_sharing is constant(no change) after booting the first guest and run dd command line in guest.
cat /sys/kernel/mm/ksm/pages_sharing
1444

This pages_sharing continues to rise(1444~59363) when booting the second guest.
cat /sys/kernel/mm/ksm/pages_sharing 
59363
 
Base on test result above, qemu-kvm option "-machine mem-merge=on/off" can enable/disable ksm per guest. So this bug is fixed.

Comment 8 juzhang 2013-11-04 04:12:36 UTC
According to comment7, set this issue as verified.

Comment 9 Ludek Smid 2014-06-13 10:36:38 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.