Re: geom_sched usage



On Tuesday 19 October 2010 10:18:24 Luigi Rizzo wrote:
On Tue, Oct 19, 2010 at 08:07:54AM +0200, David Naylor wrote:
Would there be any interest in having a rc.d/ script? I would find it
conveniant to specify a single rc.conf line and get scheduling for all my
devices. PC-BSD might find such functionality useful.

See attached for my first draft at such a script, I'm willing to hash it
into shape.

it would surely be useful but try to keep it simple and user-driven
(this is a general comment on rc.d scripts).
Some things i think you should simplify in your script:
- remove support for guessing which devices should get the scheduler.
This is really a user decision and if the user names no devices then
i believe it is better/safer not to install any scheduler.

I agree but I do think there is a case for an 'ALL' command as the user may
want scheduling on newly attached devices without knowning their device names
(i.e. attached USB storage devices).

I would also like to add a ``gsched_nodev'' that allows one to use 'ALL'
without having to apply gsched to everything.

See attached for a devd.conf file that add supports for that.

- use standard names such as gsched_flags or gsched_flags_${dev} to hold
generic and specific flags for the insert command.
It is neither useful nor flexible to have the script insert '-a'
in front of the algorithm;

I've changed the variable names. See attached for the rc.d script.

@Miroslav: thanks for the tip
notify 100 {
match "system" "DEVFS";
match "subsystem" "CDEV";
match "type" "CREATE";
match "cdev" "(ad|ada|cd|da)[0-9]+";
action "/etc/rc.d/gsched start $cdev";
};
#!/bin/sh
#
# $FreeBSD$
#
# Specify gsched_enable="YES" in /etc/rc.conf(.local) to activate scheduling on
# storage devices.
#
# gsched_devs is a space separated list of accepted devices. `ALL' may be used
# to indicate all storage devices.
#
# gsched_flags_$dev specifies storage device specific flags (i.e. ``-a rr'' to
# use rr scheduling, see gsched(8) insert command).

# TODO:
# - add gsched profiles, such as `desktop' for kern.geom.sched.rr tunables
# - add rejected list

# PROVIDE: gsched
# KEYWORD: nojail

. /etc/rc.subr

gsched_enable=${gsched_enable:-NO}

name="gsched"
rcvar=`set_rcvar`
command="/sbin/${name}"
start_cmd="gsched_start"
stop_cmd="gsched_stop"

gsched_filter() {
local _gsched_devs _devs _devs_recon _kern_disks

_kern_disks=`sysctl -n kern.disks`

_devs=$*
if [ -z "${_devs}" ]; then
_devs=${_kern_disks}
fi

_gsched_devs=${gsched_devs}
case ${_gsched_devs} in
[aA][lL][lL])
_gsched_devs=${_kern_disks}
;;
esac

for _g in ${_devs}; do
# Filter all devs that are part of gsched_devs
case " ${_gsched_devs} " in
*\ ${_g}\ *)
# Filter all devs that exist
case " ${_kern_disks} " in
*\ ${_g}\ *)
# ${_g} is part of ${gsched_dev} and it exists
_devs_recon="${_devs_recon} ${_g}"
;;
esac
;;
esac
done

echo ${_devs_recon}
}

gsched_start()
{
local _devs _g _gsched_flags

# Make sure only accepted (and existing) devices are used
#
_devs=`gsched_filter $*`

echo -n "Starting gsched devices:"

for _g in ${_devs}; do
echo -n " $_g"
eval _gsched_flags=\$gsched_flags_${_g}
${command} insert ${_gsched_flags} ${_g}
done

echo "."
}

gsched_stop() {
local _devs _g

# Make sure only accepted (and existing) devices are used
#
_devs=`gsched_filter $*`

echo -n "Stopping gsched devices:"

for _g in ${_devs}; do
echo -n " $_g"
${command} destroy ${_g}.sched.
done

echo "."
}

load_rc_config $name
run_rc_command $*

Attachment: signature.asc
Description: This is a digitally signed message part.



Relevant Pages

  • Re: PHP time monitor
    ... that could be solved with logging, but I haven't attempted it yet so I'm ... I had originally envisioned the idea that a script would ... certain time was reached the script would execute. ... > Scheduling is better done with OS-level scheduling facilities such ...
    (alt.php)
  • Re: Schedule Task
    ... I do it with my own server and with my clients' ... here is a sample script. ... Echo Hard Disk Defragmentation Report for %DateDay% ... if you're asking "Can the scheduling be DYNAMIC and start at ...
    (microsoft.public.windows.server.sbs)
  • Re: Scheduled task onlogon monthly?
    ... This page includes a link for a free download of Windows Script ... simple programs to facilitate some special scheduling needs. ... into standby before my all of my scheduled jobs can run. ...
    (microsoft.public.windowsxp.general)
  • Re: at -f working incorrectly
    ... I always do one this when scheduling jobs: ... I need help with a strange problem I'm seeing only at a customer site ... My AIX 5.3 system works correctly with the same commands. ... My product writes a single-line command to a file 'atcommand', ...
    (AIX-L)
  • [ANN] Script Timer 2.4 Released
    ... Script Timer is a user friendly script, Automator workflow, and ... scheduling, independent Automator workflow scheduling, and other ... Script Timer lets you schedule the execution of AppleScript, perl, and ...
    (comp.sys.mac.system)