RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 747010 - ksmtuned uses "vsz" instead of "rsz" when calculating qemu-kvm mem usage ( KSM turn on too early )
Summary: ksmtuned uses "vsz" instead of "rsz" when calculating qemu-kvm mem usage ( KS...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.2
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Justin M. Forbes
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-10-18 15:06 UTC by Attila Darazs
Modified: 2013-01-10 00:27 UTC (History)
15 users (show)

Fixed In Version: qemu-kvm-0.12.1.2-2.240.el6
Doc Type: Bug Fix
Doc Text:
Cause: Incorrect value has been used to calculate qemu-kvm memory usage (and turn on KSM). Consequence: KSM (Kernel Samepage Merging) turned on too early. Fix: Use real memory size instead of virtual memory size for calculating qemu-kvm memory usage. Result: Turning on KSM is more optimized
Clone Of:
Environment:
Last Closed: 2012-06-20 11:35:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Upstream patch for this (747 bytes, patch)
2012-03-05 17:11 UTC, Justin M. Forbes
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0746 0 normal SHIPPED_LIVE qemu-kvm bug fix and enhancement update 2012-06-19 19:31:48 UTC

Description Attila Darazs 2011-10-18 15:06:27 UTC
Description of problem:
In ksmtuned there's this line:
ps -C "$progname" -o vsz= | awk '{ sum += $1 }; END { print sum }'

"vsz" in not a good way to estimate the mem usage, this line makes KSM turn on way too early.

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.198.el6.x86_64.rpm

Comment 8 Justin M. Forbes 2012-03-05 17:11:41 UTC
Created attachment 567690 [details]
Upstream patch for this

This patch has been upstream for quite some time and should fix the issue.

Comment 11 Shaolong Hu 2012-03-15 09:32:27 UTC
Verified on qemu-kvm-0.12.1.2-2.248.el6.x86_64:

1. edit /etc/ksmtuned.conf
# uncomment the following if you want ksmtuned debug info
 LOGFILE=/var/log/ksmtuned
 DEBUG=1
2. #service ksmtuned restart
3. check "committed memory" at /var/log/ksmtuned


Test suggest that, on a 8G host, boot guest of 4G, ksm is activated until the 8th guest boot up.


However, i find a little flaw:

Thu Mar 15 23:37:44 CST 2012: total 7379492
Thu Mar 15 23:37:44 CST 2012: sleep 22
Thu Mar 15 23:37:44 CST 2012: thres 1475898
...
Thu Mar 15 23:47:45 CST 2012: 7005790 > 7379492, start ksm
Thu Mar 15 23:47:45 CST 2012: 1467916 < 1475898, boost
Thu Mar 15 23:47:45 CST 2012: KSMCTL start 300 22

here "7005790 > 7379492", ksm is activated when:

[ $[committed + thres] -lt $total -a $free -gt $thres ] is false

But after use rsz instead of vsz, free < thres will always happen before committed + thres > total, for there are other processes taking memory, this won't affect ksm functioning, just log confuses people, worth fixing?

Comment 12 Shaolong Hu 2012-03-23 08:49:51 UTC
Since qemu-kvm 262 removes kvm-ksmtuned-should-use-rsz-instead-of-vsz.patch from rpm spec file, move this back to assigned.

Comment 13 Michal Novotny 2012-04-02 08:04:24 UTC
(In reply to comment #12)
> Since qemu-kvm 262 removes kvm-ksmtuned-should-use-rsz-instead-of-vsz.patch
> from rpm spec file, move this back to assigned.

The patch is for the SPEC file and it has been applied manually so moving back to ON_QA. Nothing changed but the patch file is no longer here because it's not necessary to have it here.

Michal

Comment 14 Shaolong Hu 2012-04-27 02:52:11 UTC
Ok, then only the log problem, if it's not important, i am willing to verify this bug.

Comment 16 Michal Novotny 2012-05-04 08:00:34 UTC
    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:
Cause:
Incorrect value has been used to start ksmtuned.

Consequence:
KSM (Kernel Samepage Merging) turned on too early.

Fix:
Use real memory size instead of virtual memory size for calculating qemu-kvm memory usage.

Result:
Turning on KSM is more optimized

Comment 17 Michal Novotny 2012-05-04 08:01:29 UTC
    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,5 +1,5 @@
 Cause:
-Incorrect value has been used to start ksmtuned.
+Incorrect value has been used to calculate qemu-kvm memory usage (and turn on KSM).
 
 Consequence:
 KSM (Kernel Samepage Merging) turned on too early.

Comment 18 errata-xmlrpc 2012-06-20 11:35:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0746.html


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