Bug 581764

Summary: memory reported as used (by SwapCache and by Cache) though no process holds it.
Product: Red Hat Enterprise Linux 5 Reporter: RHEL Program Management <pm-rhel>
Component: kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: high    
Version: 5.5CC: aarcange, apevec, danken, ehabkost, gleb, iheim, khong, llim, lwang, lwoodman, michen, mkenneth, plyons, pm-eus, riel, tburke, virt-maint, ykaul
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kvm-83-164.el5_5.6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-18 08:07:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 575585    
Bug Blocks: 556823    

Description RHEL Program Management 2010-04-13 07:49:57 UTC
This bug has been copied from bug #575585 and has been proposed
to be backported to 5.5 z-stream (EUS).

Comment 6 Keqin Hong 2010-04-20 09:16:59 UTC
Summary:
PASS. Reproduced in kvm-83-164.el5_5.2 and verified in kvm-83-164.el5_5.6

Host environment:

processor	: 0
vendor_id	: AuthenticAMD
cpu family	: 16
model		: 2
model name	: AMD Phenom(tm) 9600B Quad-Core Processor
stepping	: 3
cpu MHz		: 1200.000
cache size	: 512 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 4
apicid		: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 5
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc nonstop_tsc pni cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy altmovcr8 abm sse4a misalignsse 3dnowprefetch osvw

...

Mem:      8G


CLI:
/usr/libexec/qemu-kvm -m 8G -smp 1 -drive file=/mnt/win2008-64.qcow2,if=ide,cache=off -net nic,model=e1000,vlan=1,macaddr=02:00:40:3F:20:10 -net tap,vlan=1,script=/etc/qemu-ifup -boot c -uuid 17544ecc-d3a1-4d3c-a386-12daf50015f1 -usbdevice tablet -no-hpet -rtc-td-hack -no-kvm-pit-reinjection -monitor stdio -notify all -cpu qemu64,+sse2 -balloon none -startdate now -vnc :11 -name 175-test1 -M rhel5.5.0

Setup:
Prepare two 64bit Windows guests (In case host has large memory, 64bit guest can support memory size above 4G).

Steps:
1. reboot host to provide a clean environment (SwapCached: 0 kB)
2. start ksm scanner (e.g. pages_to_scan 5000, sleep_time 5000)
# ksmctl 5000 5000 
3. start two Windows guests in parallel, each with large memory (e.g. equal to the physical memory size of the host ).
# /usr/libexec/qemu-kvm -m 8G -smp 1 -drive file=/mnt/win2008-64.qcow2   ...
# /usr/libexec/qemu-kvm -m 8G -smp 1 -drive file=/mnt/win2008-64.qcow2.2 ...
4. wait till pages shared by two guests become relatively stable (RES, SHR columns)
# top
...
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                        
 1830 root      20  -5     0    0    0 R 79.4  0.0   6:16.39 kksmd                                                          
 4357 root      15   0 8426m 4.5g 4.3g S  2.0 59.5   2:45.67 qemu-kvm                                                       
 4372 root      15   0 8426m 2.6g 2.4g S  0.7 34.9   3:40.03 qemu-kvm   

5. check host Swap Cache
# grep Swap /proc/meminfo 
6. shut down both Windows guests.
7. check host Swap Cache again.


Results after step 7:

1. kvm-83-164.el5_5.2
free -m
             total       used       free     shared    buffers     cached
Mem:          7718       1879       5839          0          2         16
-/+ buffers/cache:       1860       5858
Swap:         9727       1835       7892
# grep Swap /proc/meminfo 
SwapCached:    1829152 kB
SwapTotal:     9961464 kB
SwapFree:      8082072 kB

2. kvm-83-164.el5_5.6
# free -m
             total       used       free     shared    buffers     cached
Mem:          7718        916       6802          0         25        798
-/+ buffers/cache:         92       7626
Swap:         9727         79       9648
[root@dhcp-91-175 ~]# grep Swap /proc/meminfo 
SwapCached:       6152 kB
SwapTotal:     9961464 kB
SwapFree:      9879556 kB

Comment 9 errata-xmlrpc 2010-05-18 08:07:23 UTC
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/RHBA-2010-0419.html