Bug#423259: boinc-client: Use advanced scheduling
Omen Wild
dbug4.flibble at mandarb.com
Thu May 10 23:18:32 UTC 2007
Package: boinc-client
Version: 5.8.17-1+b1
Severity: wishlist
Tags: patch
I have attached a patch to the init script to make the boinc client
(and children) get scheduled with more advanced schedulers if available
and if the schedtool package is installed. It first tries idleprio,
then batch, and falls back to nice if neither of those is available.
It also tries to schedule the IO to batch using the ionice command if
that is installed.
I also added a print out of current scheduling to the status command.
The advance scheduling makes the boinc computations interfere as little
as possible with current operations, even less so than using nice does.
The while loop waiting for the pid file may seem like overkill but I've
had a couple times where it took a little while for the pid file to
show up.
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.21.1-ck1-1 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages boinc-client depends on:
ii adduser 3.102 Add and remove users and groups
ii ca-certi 20070303 Common CA Certificates PEM files
ii debconf 1.5.13 Debian configuration management sy
ii libc6 2.5-7 GNU C Library: Shared libraries
ii libcomer 1.39+1.40-WIP-2007.04.07+dfsg-2 common error description library
ii libcurl3 7.15.5-1 Multi-protocol file transfer libra
ii libgcc1 1:4.1.2-6 GCC support library
ii libidn11 0.6.5-1 GNU libidn library, implementation
ii libkrb53 1.6.dfsg.1-3 MIT Kerberos runtime libraries
ii libssl0. 0.9.8e-4 SSL shared libraries
ii libstdc+ 4.1.2-6 The GNU Standard C++ Library v3
ii lsb-base 3.1-23.1 Linux Standard Base 3.1 init scrip
ii python 2.4.4-3 An interactive high-level object-o
ii zlib1g 1:1.2.3-13 compression library - runtime
boinc-client recommends no packages.
-- debconf information excluded
-------------- next part --------------
--- boinc-client.init.old 2007-05-01 11:36:36.000000000 -0700
+++ boinc-client.init 2007-05-10 16:05:04.000000000 -0700
@@ -94,11 +94,64 @@
log_end_msg 0
}
+schedule()
+{
+ log_begin_msg "Setting up scheduling for $DESC and children:"
+
+ if ! is_running; then
+ log_progress_msg "not running"
+ log_end_msg 0
+ else
+ local pid max
+ max=5
+ while [[ $max -gt 0 ]]; do
+ if [[ -f $PIDFILE ]]; then
+ pid=$(cat $PIDFILE)
+ break
+ fi
+ sleep 1
+ max=$((max-1))
+ done
+
+ if [[ -z $pid ]]; then
+ log_failure_msg "unable to find pid to do scheduling."
+ return 1
+ fi
+
+ if ! which schedtool >/dev/null; then
+ log_progress_msg "Warning: no schedtool in the path"
+ else
+ children=$(ps --ppid $pid -opid= || true)
+ ( sudo schedtool -n 20 -D $pid $children >/dev/null && log_progress_msg "idleprio,") || \
+ (sudo schedtool -n 20 -B $pid $children >/dev/null && log_progress_msg "batch," ) || \
+ (sudo schedtool -n 20 $pid $children && log_progress_msg "only niced,")
+ fi
+ if ! which ionice >/dev/null; then
+ log_progress_msg "Warning: no ionice in the path"
+ else
+ ionice -n 4 -c 3 -p $pid
+ log_progress_msg "ioniced"
+ fi
+
+ log_end_msg 0
+ fi
+}
+
status()
{
STATUS="Status of $DESC:"
if is_running; then
log_success_msg "$STATUS running."
+ if which schedtool >/dev/null; then
+ local pid
+ pid=$(cat $PIDFILE)
+ log_success_msg ""
+ log_success_msg "Scheduling of $DESC:"
+ schedtool -v $pid
+ log_success_msg ""
+ log_success_msg "Scheduling of $DESC's children:"
+ schedtool -v $(ps --ppid $pid -opid=)
+ fi
else
log_success_msg "$STATUS stopped."
fi
@@ -107,6 +160,11 @@
case "$1" in
start)
start
+ schedule
+ ;;
+
+ schedule)
+ schedule
;;
stop)
@@ -124,7 +182,7 @@
;;
*)
- log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}" >&2
+ log_success_msg "Usage: $0 {start|stop|restart|force-reload|status|schedule}" >&2
exit 1
;;
esac
More information about the pkg-boinc-devel
mailing list