Bug 1027418 - ksmtuned committed_memory() still returns "", not 0, when no qemu running
Summary: ksmtuned committed_memory() still returns "", not 0, when no qemu running
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Miroslav Rezanina
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-06 19:08 UTC by Cole Robinson
Modified: 2014-06-18 03:41 UTC (History)
7 users (show)

Fixed In Version: qemu-kvm-1.5.3-22.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1012610
Environment:
Last Closed: 2014-06-13 10:51:35 UTC
Target Upstream Version:


Attachments (Terms of Use)

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.


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