Michael Tokarev: set nice value of the check/resync thread too, together with I/O scheduling class (Closes: #652547)

Michael Tokarev mjt at alioth.debian.org
Tue Jan 10 18:30:38 UTC 2012


Module: mdadm
Branch: build
Commit: 03fdd1c4268ae5464bf2319cc0767d60789ddaf9
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=03fdd1c4268ae5464bf2319cc0767d60789ddaf9

Author: Michael Tokarev <mjt at tls.msk.ru>
Date:   Tue Jan 10 19:07:45 2012 +0400

set nice value of the check/resync thread too, together with I/O scheduling class (Closes: #652547)

---

 debian/changelog  |    2 ++
 debian/checkarray |   23 ++++++++++++-----------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 77d8cd0..7af3ad1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,8 @@ mdadm (3.2.3-1) UNRELEASED; urgency=low
     While at it, remove mention of devfsd
   * added Slovak (sk.po) po-debconf translation from Slavko <linux at slavino.sk>
     (Closes: #641972)
+  * set nice value of the check/resync thread too, together with I/O
+    scheduling class, based on patch by Sergey B Kirpichev (Closes: #652547)
 
   [ Peter Eisentraut ]
   * Added support for "status" action to mdadm init script (Closes: #651737)
diff --git a/debian/checkarray b/debian/checkarray
index df9bba7..96538e3 100644
--- a/debian/checkarray
+++ b/debian/checkarray
@@ -27,10 +27,10 @@ usage()
 	-a|--all & check all assembled arrays (check /proc/mdstat).
 	-s|--status & print redundancy check status of devices.
 	-x|--cancel & queue a request to cancel a running redundancy check.
-	-i|--idle & perform check in a lowest I/O scheduling class (idle).
-	-l|--slow & perform check in a lower-than-standard I/O scheduling class.
-	-f|--fast & perform check in higher-than-standard I/O scheduling class.
-	--realtime & perform check in real-time I/O scheduling class (DANGEROUS!).
+	-i|--idle & perform check in a lowest scheduling class (idle)
+	-l|--slow & perform check in a lower-than-standard scheduling class
+	-f|--fast & perform check in higher-than-standard scheduling class
+	--realtime & perform check in real-time scheduling class (DANGEROUS!)
 	-c|--cron & honour AUTOCHECK setting in /etc/default/mdadm.
 	-q|--quiet & suppress informational messages.
 	-Q|--real-quiet & suppress all output messages, including warnings and errors.
@@ -181,11 +181,11 @@ for array in $arrays; do
       [ $quiet -lt 1 ] && echo "$PROGNAME: I: check queued for array $array." >&2
 
       case "$ionice" in
-        idle) arg='-c3';;
-        low) arg='-c2 -n7';;
-        high) arg='-c2 -n0';;
-        realtime) arg='-c1 -n4';;
-        *) continue;;
+        idle) ioarg='-c3'; renice=15;;
+        low) ioarg='-c2 -n7'; renice=5;;
+        high) ioarg='-c2 -n0'; renice=0;;
+        realtime) ioarg='-c1 -n4'; renice=-5;;
+        *) break;;
       esac
 
       resync_pid= wait=5
@@ -193,8 +193,9 @@ for array in $arrays; do
         wait=$((wait - 1))
         resync_pid=$(ps -ef | awk -v dev=$array 'BEGIN { pattern = "^\\[" dev "_resync]$" } $8 ~ pattern { print $2 }')
         if [ -n "$resync_pid" ]; then
-          [ $quiet -lt 1 ] && echo "$PROGNAME: I: selecting $ionice I/O scheduling class for resync of $array." >&2
-          ionice -p "$resync_pid" $arg || :
+          [ $quiet -lt 1 ] && echo "$PROGNAME: I: selecting $ionice I/O scheduling class and $renice niceness for resync of $array." >&2
+          ionice -p "$resync_pid" $ioarg || :
+          renice -n $renice -p "$resync_pid" 1>/dev/null || :
           break
         fi
         sleep 1




More information about the pkg-mdadm-commits mailing list