rtirq: low priority limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rui (and all),

I'm attaching two small patches that adds a lower priority limit to the rtirq script (with a matching configuration variable). This is useful to have if you have a limited range of available priority "steps" because, for example, a distribution restricts the maximum priority a user is allowed to have. With this change you can make sure that the priority of all irq processes is higher than the priority of (say) the jackd process, no matter how many processes you have. Reasonable defaults are chosen if the variable is not configured.

Do you think you could add this to your package?
Thanks,
-- Fernando

PS: how about incorporating my previous "additions" as well in rtirq? (ie: irq priority change through udev when a soundcard is inserted and remembering priorities between sleep and resume).
--- /etc/rc.d/init.d/rtirq-old	2012-05-04 15:56:30.000000000 -0700
+++ /etc/rc.d/init.d/rtirq	2012-05-23 11:59:29.862878412 -0700
@@ -172,6 +168,7 @@
 				;;
 			esac
 			PRI2=$((${PRI2} - 1))
+			[ ${PRI2} -le ${PRI0_LOW} ] && PRI2=${PRI0_LOW}
 		done
 	fi
 }
@@ -190,6 +187,7 @@
 	do
 		rtirq_exec_num ${ACTION} "${NAME1}" "${NAME2}" ${PRI1} ${IRQ}
 		PRI1=$((${PRI1} - 1))
+		[ ${PRI1} -le ${PRI0_LOW} ] && PRI1=${PRI0_LOW}
 	done
 }
 
@@ -240,6 +238,10 @@
 	DECR=${RTIRQ_PRIO_DECR:-5}
 	[ $((${DECR})) -gt 10 ] && DECR=10
 	[ $((${DECR})) -lt  1 ] && DECR=1
+	# Check configured lower limit of priority.
+	PRI0_LOW=${RTIRQ_PRIO_LOW:-51}
+	[ $((${PRI0_LOW})) -gt $((${PRI0})) ] && PRI0_LOW=${PRI0}
+	[ $((${PRI0_LOW})) -lt  51 ] && PRI0_LOW=51
 	# (Re)set all softirq-timer/s to highest priority.
 	rtirq_exec_high ${ACTION}
 	# Process all configured service names...
@@ -248,7 +250,7 @@
 		case ${NAME} in
 		snd)
 			PRI1=${PRI0}
-			grep irq /proc/asound/cards | tac | \
+			grep irq /proc/asound/cards  | \
 			sed 's/\(.*\) at .* irq \(.*\)/\2 \1/' | \
 			while read IRQ NAME1
 			do
@@ -258,6 +260,7 @@
 				do
 					rtirq_exec_num ${ACTION} "${NAME}" "${NAME2}" ${PRI1} ${IRQ}
 					PRI1=$((${PRI1} - 1))
+					[ ${PRI1} -le ${PRI0_LOW} ] && PRI1=${PRI0_LOW}
 				done
 			done
 			;;
@@ -271,6 +274,7 @@
 			;;
 		esac
 		[ ${PRI0} -gt ${DECR} ] && PRI0=$((${PRI0} - ${DECR}))
+		[ ${PRI0} -le ${PRI0_LOW} ] && PRI0=${PRI0_LOW}
 	done
 }
 
--- rtirq.conf~	2012-05-04 04:20:31.000000000 -0700
+++ rtirq.conf	2012-05-23 12:40:11.738278138 -0700
@@ -35,6 +35,9 @@
 # Priority decrease step.
 RTIRQ_PRIO_DECR=5
 
+# Lowest priority.
+RTIRQ_PRIO_LOW=51
+
 # Whether to reset all IRQ threads to SCHED_OTHER.
 RTIRQ_RESET_ALL=0
 
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/listinfo/linux-audio-user

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux