Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1027418

Summary: ksmtuned committed_memory() still returns "", not 0, when no qemu running
Product: Red Hat Enterprise Linux 7 Reporter: Cole Robinson <crobinso>
Component: qemu-kvmAssignee: Miroslav Rezanina <mrezanin>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: acathrow, areis, hhuang, juzhang, shu, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-22.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1012610 Environment:
Last Closed: 2014-06-13 10:51:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Cole Robinson 2013-11-06 19:08:30 UTC
+++ This bug was initially created as a clone of Bug #1012610 +++

Description of problem:
Despite the efforts in #609016 and #902688, this is still / again broken.

Version of selected components:
ksm-1.4.2-9.fc19.x86_64

How to reproduce:
Understand committed_memory() in ksmtuned, then:

$ < /dev/null awk '{ sum += $1 }; END { print sum }'

$ 

Additional info:
Please change the awk clause in line 77 of ksmtuned to the obvious and correct solution: 'END { print 0+sum }':

$ < /dev/null awk '{ sum += $1 }; END { print 0+sum }'
0
$

--- Additional comment from Cole Robinson on 2013-10-31 16:24:12 EDT ---

Thanks for the suggestion, moving to POST since there's a fix

--- Additional comment from Fedora Update System on 2013-11-05 20:27:03 EST ---

qemu-1.4.2-13.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/qemu-1.4.2-13.fc19



Here's the diff we applied in Fedora:

diff --git a/ksmtuned b/ksmtuned
index c96507c..7bc5743 100644
--- a/ksmtuned
+++ b/ksmtuned
@@ -71,10 +71,10 @@ KSMCTL () {
 committed_memory () {
     # calculate how much memory is committed to running qemu processes
     local pidlist
-    pidlist=$(pgrep -d ' ' -- '^qemu(-kvm|:.{1,11})$')
+    pidlist=$(pgrep -d ' ' -- '^qemu(-(kvm|system-.+)|:.{1,11})$')
     if [ -n "$pidlist" ]; then
         ps -p "$pidlist" -o rsz=
-    fi | awk '{ sum += $1 }; END { print sum }'
+    fi | awk '{ sum += $1 }; END { print 0+sum }'
 }
 
 free_memory () {

(covers another bug as well)

Comment 2 Michal Novotny 2013-12-17 11:14:33 UTC
Fixed in version qemu-kvm-1.5.3-22.el7.

Michal

Comment 6 Shaolong Hu 2013-12-27 09:11:22 UTC
In qemu-kvm-1.5.3-30.el7.x86_64:

committed_memory () {
    local pidlist
    pidlist=$(pgrep -d ' ' -- '^qemu(-kvm|:.{1,11})$')
    if [ -n "$pidlist" ]; then
        ps -p "$pidlist" -o rsz=
    fi | awk '{ sum += $1 }; END { print 0+sum }'
}


Here:

-    pidlist=$(pgrep -d ' ' -- '^qemu(-kvm|:.{1,11})$')
+    pidlist=$(pgrep -d ' ' -- '^qemu(-(kvm|system-.+)|:.{1,11})$')

Above patch does not apply, only:

-    fi | awk '{ sum += $1 }; END { print sum }'
+    fi | awk '{ sum += $1 }; END { print 0+sum }'


If this is intended, then verified.

Comment 7 Ludek Smid 2014-06-13 10:51:35 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.