Bug 1017832

Summary: [RFE] ksmtuned and /sys/kernel/mm/ksm/run do not respect RHEV-M GUI settings
Product: Red Hat Enterprise Virtualization Manager Reporter: Robert McSwain <rmcswain>
Component: ovirt-engine-webadmin-portalAssignee: Doron Fediuck <dfediuck>
Status: CLOSED DUPLICATE QA Contact: Pavel Stehlik <pstehlik>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.2.0CC: acathrow, dfediuck, ecohen, fdeutsch, iheim, mavital, milan.zelenka, Rhev-m-bugs, rmcswain, sherold, yeylon
Target Milestone: ---Keywords: FutureFeature, Triaged
Target Release: ---Flags: sherold: Triaged+
Hardware: Unspecified   
OS: Linux   
Whiteboard: sla
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-06 15:44:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: SLA RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
mem-share none

Description Robert McSwain 2013-10-10 15:13:02 UTC
Description of problem:
Although the GUI reports "Memory page sharing: inactive", unless ksmtuned is stopped manually with 'service ksmtuned stop', kernel shared memory is still used. In addition, on the RHEV-H there is no easy way to chkconfig the service off so that ksmtuned stays off upon reboot.

Version-Release number of selected component (if applicable):
Red Hat Enterprise Virtualization Hypervisor release 6.4 (20130709.0.el6_4)

How reproducible:
Set Memory page sharing to Inactive and check for ksmtuned running with cat /sys/kernel/mm/ksm/run

Steps to Reproduce:
1. Set Memory page sharing to Inactive
2. ps aux|grep ksmtuned
3. cat /sys/kernel/mm/ksm/run
4. Observe the service is still running

Actual results:
ksmtuned has to be manually stopped and starts up after a reboot of the hypervisor

Expected results:
ksmtuned is disabled and chkconfig'd off

Additional info:
This can be worked around with the following:

1) Add exit 0 to the two following files:
/etc/sysconfig/ksm
/etc/ksmtuned.conf

[root@localhost admin]# cat /etc/sysconfig/ksm 
# The maximum number of unswappable kernel pages
# which may be allocated by ksm (0 for unlimited)
# If unset, defaults to half of total memory
# KSM_MAX_KERNEL_PAGES=i
exit 0 <-----------------------------------------------------------Added

[root@localhost admin]# cat /etc/ksmtuned.conf 
# Configuration file for ksmtuned.

# How long ksmtuned should sleep between tuning adjustments
# KSM_MONITOR_INTERVAL=60

# Millisecond sleep between ksm scans for 16Gb server.
# Smaller servers sleep more, bigger sleep less.
# KSM_SLEEP_MSEC=10

# KSM_NPAGES_BOOST=300
# KSM_NPAGES_DECAY=-50
# KSM_NPAGES_MIN=64
# KSM_NPAGES_MAX=1250

# KSM_THRES_COEF=20
# KSM_THRES_CONST=2048

# uncomment the following if you want ksmtuned debug info

# LOGFILE=/var/log/ksmtuned
# DEBUG=1
exit 0 <-----------------------------------------------------------Added

2) Persist the files

[root@localhost admin]# persist /etc/ksmtuned.conf 
 File persisted

Successfully persisted /etc/ksmtuned.conf

[root@localhost admin]# persist /etc/sysconfig/ksm 
 File persisted

Successfully persisted /etc/sysconfig/ksm


3) After a restart of the hypervisor you will see that the service is chkconfig'd on but the process will be dead:

[root@localhost admin]# chkconfig --list ksm;chkconfig --list ksmtuned
ksm            	0:off	1:off	2:off	3:on	4:on	5:on	6:off
ksmtuned       	0:off	1:off	2:off	3:on	4:on	5:on	6:off

[root@localhost admin]# /etc/init.d/ksmtuned status
ksmtuned dead but subsys locked

[root@localhost admin]# cat /sys/kernel/mm/ksm/run
0

Comment 1 Robert McSwain 2013-10-11 15:19:38 UTC
Customer has also confirmed that this is seen on the hypervisor build of Red Hat Enterprise Virtualization Hypervisor release 6.4 (20130912.1.el6_4)

Comment 2 Doron Fediuck 2013-10-31 09:14:40 UTC
Hi Robert,
There's a misunderstanding here I'd like to clarify.

KSM daemon activity is handled by vdsm and the configured thresholds.
RHEV-M only reports KSM activity but does not control it. The current design
is to let KSM always work using this policy.

You can see a related issue here: https://bugzilla.redhat.com/show_bug.cgi?id=854027#c11

The Cluster UI dialog you're referring to, handles the scheduling considerations.
So if, for example, you select server utilization (150%), when running a VM the
scheduler will consider up to 150% of the available memory for the relevant hosts. In your case it will use only the reported available memory disallowing
memory over-commitment.

Can you explain more about your need to disable ksm even if not being considered
by the RHEV-M engine?

Comment 3 Robert McSwain 2013-11-08 14:30:22 UTC
Doron, 
Sure thing! I'll confirm the customer's need for this and let you know what he has to say as soon as possible. Thanks!

Comment 4 Robert McSwain 2013-11-21 23:05:34 UTC
Here's the information from the customer
~~~
We have 1 host cluster with only 1 VM (bigger MS SQL database and we need to separate it). KSM function is not desirable and unnecessary in this scenario, because it consumes system resources.

We are seeing memory sharing is active and 2% of memory is shared in the RHEV-M.

I think that if I set policy of memory page sharing to "None", ksmtuned can be active but it shouldn't share any RAM.
~~~
Is the customer mistaken about how the memory page sharing option of "None" works?

Comment 5 Doron Fediuck 2013-11-24 10:39:06 UTC
Created attachment 828273 [details]
mem-share

Hi,
Attaching the tool tip to show that we're actually explaining that these settings are about the amount of VMs you may run using memory sharing. So if needed you can manually disable ksm in the hosts. Going forward (3.4) we'll add a special setting for it in the UI, based on bug 1026980.