Date: Wed, 20 Oct 2010 19:38:54 +0200 From: David Naylor <naylor.b.david@gmail.com> To: Luigi Rizzo <rizzo@iet.unipi.it> Cc: freebsd-current@freebsd.org, Miroslav Lachman <000.fbsd@quip.cz> Subject: Re: geom_sched usage Message-ID: <201010201938.58687.naylor.b.david@gmail.com> In-Reply-To: <20101019081824.GB54147@onelab2.iet.unipi.it> References: <201010180943.37042.naylor.b.david@gmail.com> <201010190807.59491.naylor.b.david@gmail.com> <20101019081824.GB54147@onelab2.iet.unipi.it>
next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart2844468.XcjDmbjXDk Content-Type: multipart/mixed; boundary="Boundary-01=_ukyvMrk5pPo7POE" Content-Transfer-Encoding: 7bit --Boundary-01=_ukyvMrk5pPo7POE Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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. > >=20 > > See attached for my first draft at such a script, I'm willing to hash it > > into shape. >=20 > 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= =20 want scheduling on newly attached devices without knowning their device nam= es=20 (i.e. attached USB storage devices). =20 I would also like to add a ``gsched_nodev'' that allows one to use 'ALL'=20 without having to apply gsched to everything. =20 See attached for a devd.conf file that add supports for that. =20 > - 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. =20 @Miroslav: thanks for the tip --Boundary-01=_ukyvMrk5pPo7POE Content-Type: text/plain; charset="ISO-8859-1"; name="gsched.conf.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gsched.conf.txt" 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"; }; --Boundary-01=_ukyvMrk5pPo7POE Content-Type: text/plain; charset="ISO-8859-1"; name="gsched.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="gsched.txt" #!/bin/sh # # $FreeBSD$ # # Specify gsched_enable=3D"YES" in /etc/rc.conf(.local) to activate schedul= ing on # storage devices. =20 #=20 # gsched_devs is a space separated list of accepted devices. `ALL' may be = used=20 # to indicate all storage devices. =20 # # gsched_flags_$dev specifies storage device specific flags (i.e. ``-a rr''= to # use rr scheduling, see gsched(8) insert command). =20 # TODO: # - add gsched profiles, such as `desktop' for kern.geom.sched.rr tunables # - add rejected list # PROVIDE: gsched # KEYWORD: nojail =2E /etc/rc.subr gsched_enable=3D${gsched_enable:-NO} name=3D"gsched" rcvar=3D`set_rcvar` command=3D"/sbin/${name}" start_cmd=3D"gsched_start" stop_cmd=3D"gsched_stop" gsched_filter() { local _gsched_devs _devs _devs_recon _kern_disks _kern_disks=3D`sysctl -n kern.disks` _devs=3D$* if [ -z "${_devs}" ]; then _devs=3D${_kern_disks} fi _gsched_devs=3D${gsched_devs} case ${_gsched_devs} in [aA][lL][lL]) _gsched_devs=3D${_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=3D"${_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=3D`gsched_filter $*` echo -n "Starting gsched devices:" for _g in ${_devs}; do echo -n " $_g" eval _gsched_flags=3D\$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=3D`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 $* --Boundary-01=_ukyvMrk5pPo7POE-- --nextPart2844468.XcjDmbjXDk Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEABECAAYFAky/KTIACgkQUaaFgP9pFrKINwCeOqM9aIPT3/nVAAM3IEXDlc0J HVgAoIUXmVzFHqNGaLF/NgUZObcJVXPK =jnBA -----END PGP SIGNATURE----- --nextPart2844468.XcjDmbjXDk--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010201938.58687.naylor.b.david>