1bfeda
From 26db89de18efad1b453618ea8156422d26e0c85f Mon Sep 17 00:00:00 2001
1bfeda
From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= <jskarvad@redhat.com>
1bfeda
Date: Tue, 8 Jan 2019 15:00:33 +0100
1bfeda
Subject: [PATCH] mssql: updated tuning
1bfeda
MIME-Version: 1.0
1bfeda
Content-Type: text/plain; charset=UTF-8
1bfeda
Content-Transfer-Encoding: 8bit
1bfeda
1bfeda
Added vm plugin option 'transparent_hugepage.defrag'.
1bfeda
1bfeda
Resolves: rhbz#1660178
1bfeda
1bfeda
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
1bfeda
---
1bfeda
 profiles/mssql/tuned.conf  |  9 ++++++++-
1bfeda
 tuned/plugins/plugin_vm.py | 32 +++++++++++++++++++++++++++-----
1bfeda
 2 files changed, 35 insertions(+), 6 deletions(-)
1bfeda
1bfeda
diff --git a/profiles/mssql/tuned.conf b/profiles/mssql/tuned.conf
1bfeda
index 2491717..35e208a 100644
1bfeda
--- a/profiles/mssql/tuned.conf
1bfeda
+++ b/profiles/mssql/tuned.conf
1bfeda
@@ -6,5 +6,12 @@
1bfeda
 summary=Optimize for MS SQL Server
1bfeda
 include=throughput-performance
1bfeda
 
1bfeda
+[vm]
1bfeda
+transparent_hugepage.defrag=always
1bfeda
+
1bfeda
 [sysctl]
1bfeda
-vm.max_map_count=262144
1bfeda
+vm.max_map_count=800000
1bfeda
+kernel.numa_balancing=0
1bfeda
+kernel.sched_latency_ns=60000000
1bfeda
+kernel.sched_min_granularity_ns=15000000
1bfeda
+kernel.sched_wakeup_granularity_ns=2000000
1bfeda
diff --git a/tuned/plugins/plugin_vm.py b/tuned/plugins/plugin_vm.py
1bfeda
index be570e2..9021ac3 100644
1bfeda
--- a/tuned/plugins/plugin_vm.py
1bfeda
+++ b/tuned/plugins/plugin_vm.py
1bfeda
@@ -20,6 +20,7 @@ class VMPlugin(base.Plugin):
1bfeda
 		return {
1bfeda
 			"transparent_hugepages" : None,
1bfeda
 			"transparent_hugepage" : None,
1bfeda
+			"transparent_hugepage.defrag" : None,
1bfeda
 		}
1bfeda
 
1bfeda
 	def _instance_init(self, instance):
1bfeda
@@ -30,10 +31,11 @@ class VMPlugin(base.Plugin):
1bfeda
 		pass
1bfeda
 
1bfeda
 	@classmethod
1bfeda
-	def _thp_file(self):
1bfeda
-		path = "/sys/kernel/mm/transparent_hugepage/enabled"
1bfeda
+	def _thp_path(self):
1bfeda
+		path = "/sys/kernel/mm/transparent_hugepage"
1bfeda
 		if not os.path.exists(path):
1bfeda
-			path =  "/sys/kernel/mm/redhat_transparent_hugepage/enabled"
1bfeda
+			# RHEL-6 support
1bfeda
+			path =  "/sys/kernel/mm/redhat_transparent_hugepage"
1bfeda
 		return path
1bfeda
 
1bfeda
 	@command_set("transparent_hugepages")
1bfeda
@@ -49,7 +51,7 @@ class VMPlugin(base.Plugin):
1bfeda
 				log.info("transparent_hugepage is already set in kernel boot cmdline, ingoring value from profile")
1bfeda
 			return None
1bfeda
 
1bfeda
-		sys_file = self._thp_file()
1bfeda
+		sys_file = os.path.join(self._thp_path(), "enabled")
1bfeda
 		if os.path.exists(sys_file):
1bfeda
 			if not sim:
1bfeda
 				cmd.write_to_file(sys_file, value)
1bfeda
@@ -66,7 +68,7 @@ class VMPlugin(base.Plugin):
1bfeda
 
1bfeda
 	@command_get("transparent_hugepages")
1bfeda
 	def _get_transparent_hugepages(self):
1bfeda
-		sys_file = self._thp_file()
1bfeda
+		sys_file = os.path.join(self._thp_path(), "enabled")
1bfeda
 		if os.path.exists(sys_file):
1bfeda
 			return cmd.get_active_option(cmd.read_file(sys_file))
1bfeda
 		else:
1bfeda
@@ -76,3 +78,23 @@ class VMPlugin(base.Plugin):
1bfeda
 	@command_get("transparent_hugepage")
1bfeda
 	def _get_transparent_hugepage(self):
1bfeda
 		return self._get_transparent_hugepages()
1bfeda
+
1bfeda
+	@command_set("transparent_hugepage.defrag")
1bfeda
+	def _set_transparent_hugepage_defrag(self, value, sim):
1bfeda
+		sys_file = os.path.join(self._thp_path(), "defrag")
1bfeda
+		if os.path.exists(sys_file):
1bfeda
+			if not sim:
1bfeda
+				cmd.write_to_file(sys_file, value)
1bfeda
+			return value
1bfeda
+		else:
1bfeda
+			if not sim:
1bfeda
+				log.warn("Option 'transparent_hugepage.defrag' is not supported on current hardware.")
1bfeda
+			return None
1bfeda
+
1bfeda
+	@command_get("transparent_hugepage.defrag")
1bfeda
+	def _get_transparent_hugepage_defrag(self):
1bfeda
+		sys_file = os.path.join(self._thp_path(), "defrag")
1bfeda
+		if os.path.exists(sys_file):
1bfeda
+			return cmd.get_active_option(cmd.read_file(sys_file))
1bfeda
+		else:
1bfeda
+			return None
1bfeda
-- 
1bfeda
2.20.1
1bfeda