File set_kthread_prio-modernize-it-a-bit.diff of Package ibmrtpkgs.15904

Subject: Modernize set_kthread_prio a bit
From: Mike Galbraith <mgalbraith@suse.de>
References: bnc#966818

Signed-off-by: Mike Galbraith <mgalbraith@suse.de>
---
 set_kthread_prio/set_kthread_prio      |   14 ++++--
 set_kthread_prio/set_kthread_prio.conf |   70 ++++++++++++++++++++++++++-------
 2 files changed, 66 insertions(+), 18 deletions(-)

--- a/set_kthread_prio/set_kthread_prio
+++ b/set_kthread_prio/set_kthread_prio
@@ -7,10 +7,10 @@
 #
 ### BEGIN INIT INFO
 # Provides: set_kthread_prio
-# Required-Start: 
+# Required-Start:
 # Required-Stop:
 # Default-Start: 2 3 4 5
-# Default-Stop: 
+# Default-Stop:
 # Description: Manages the policy and priority of RT kernel threads on startup
 ### END INIT INFO
 
@@ -23,7 +23,7 @@ set_kthread_cmds () {
     fi
 
     ps -eo pid,cmd | \
-	awk '/^[a-zA-Z_0-9-]+[ 	]+-[rfo][ 	]+[0-9]+$/ {
+	awk '/^[a-zA-Z_0-9-]+[ 	]+-[rfox]*[ 	]+[0-9\-]+$/ {
 			printf("# '%s' = '%s' (%s)\n", $1, $3, $2);
 			config[$1]=$3
 			confopts[$1]=$2
@@ -35,9 +35,11 @@ set_kthread_cmds () {
 			       cmd=$2
 			}
 			cmd=substr(cmd, 2, length(cmd)-2); 
+			sub(/\/[0-9]*-/,"-",cmd);
 			sub(/\/[0-9]*$/,"",cmd); 
+			sub(/\[*$/,"",cmd);
 			sub(/\/$/,"",cmd); 
-			sub(/[	].*$/,"",cmd);
+			sub(/[/@: ].*$/,"",cmd);
 			sub(/ /,"_",cmd);
 			prio = "-";
 			opts = "";
@@ -56,6 +58,10 @@ set_kthread_cmds () {
 				   "sirq_default" in config) {
 				prio = config["sirq_default"];
 				opts = confopts["sirq_default"];
+			} else if ((cmd ~ /^vhost/ || cmd ~ /^kvm-/) &&
+				   "virt_default" in config) {
+				prio = config["virt_default"];
+				opts = confopts["virt_default"];
 			} else if ("default" in config) {
 				prio = config["default"];
 				opts = confopts["default"];
--- a/set_kthread_prio/set_kthread_prio.conf
+++ b/set_kthread_prio/set_kthread_prio.conf
@@ -1,14 +1,56 @@
-watchdog        -f	99
-migration	-f	99
-posix_cpu_timer -f      99
-IRQ_default	-f	95
-irq_default	-f	95
-sirq-hrtimer	-f	92
-sirq-net-tx	-f	90
-sirq-net-rx	-f	90
-sirq-rcu	-f	90
-sirq_default	-f	49
-rpciod          -f      49
-lockd           -f      49
-nfsd            -f      49
-default		-	-
+watchdog	-f	99
+
+# hardirq threads
+irq-hda_inte	-f	95
+irq-rtc0	-f	90
+irq-i8042	-f	40
+irq-eth0	-f	30
+irq-ehci	-f	20
+irq-ahci	-f	20
+irq-ehci_hcd	-f	20
+irq-uhci_hcd	-f	20
+irq-acpi	-o	0
+irq-firewire	-o	0
+irq-saa7133	-o	0
+irq-serial	-o	0
+irq-nvidia	-o	0
+#old/new hard irq defaults
+IRQ_default	-f	10
+irq_default	-f	10
+
+# softirq threads
+sirq-high	-f	90
+sirq-hrtimer	-f	99
+sirq-timer	-f	60
+sirq-tasklet	-f	50
+sirq-net-tx	-f	30
+sirq-net-rx	-f	30
+sirq-sched	-o	0
+sirq-blk	-o	0
+sirq-blk-pol	-o	0
+sirq-rcu	-f	2
+sirq_default	-f	1
+# ksoftirqd	-f	1
+
+# vm threads
+kswapd0		-o	0
+
+# nfs
+rpciod          -f      2
+lockd           -f      2
+nfsd            -f      2
+nfsd4_callbacks -f      2
+
+# rcu
+rcuc		-f	2
+rcuob		-f 	2
+rcuos		-f	2
+rcu_bh		-f	2
+rcu_sched	-f	2
+
+# virt
+virt_default	-f	5
+
+# everybody else
+default		-x	-
+
openSUSE Build Service is sponsored by