From owner-freebsd-current@FreeBSD.ORG Wed Oct 20 17:39:12 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A426910656A3 for ; Wed, 20 Oct 2010 17:39:12 +0000 (UTC) (envelope-from naylor.b.david@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 26FE98FC18 for ; Wed, 20 Oct 2010 17:39:11 +0000 (UTC) Received: by wyb38 with SMTP id 38so4138728wyb.13 for ; Wed, 20 Oct 2010 10:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:cc:references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=UZ/0Ji/3MXGU56tNu+pD5MStlfJ14lYdo8LPVpNdQiw=; b=YoCmXsswSS4yqU3xJP/znpWpmDmYmlkQ2yj+78B/fZOX7Z5ee88ZV6v6yjFLG8D5Qw PyGX+wlSdtCXZY+9kN3gJw/7VEdzuMJNNypoCITMe8hRqHHQ0YM5RnzsWf3ul5bhFJqO RRjqn7t1NBVecdl1oPtGydYFw3xSlzPfX3LZU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; b=MLLJMQ9t+hxNuAhq1uwsxhTR67q7JdB3Q78NVOpNnPUrIAl584/E81W30icueyzbLJ ME1dn2jXCPIpVD+fgORQY8hxUl1Rf4zQzSo3n2ak5UPUh06ZJOGNKxVfstC24+8/w0Yz p/x56iyOsvcW2Q1lxEFNsK8346XStYn4RGPl0= Received: by 10.227.145.66 with SMTP id c2mr4639643wbv.34.1287596351043; Wed, 20 Oct 2010 10:39:11 -0700 (PDT) Received: from dragon.dg (41-132-93-155.dsl.mweb.co.za [41.132.93.155]) by mx.google.com with ESMTPS id ga16sm400085wbb.13.2010.10.20.10.39.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 20 Oct 2010 10:39:09 -0700 (PDT) From: David Naylor To: Luigi Rizzo Date: Wed, 20 Oct 2010 19:38:54 +0200 User-Agent: KMail/1.13.5 (FreeBSD/9.0-CURRENT; KDE/4.5.1; amd64; ; ) References: <201010180943.37042.naylor.b.david@gmail.com> <201010190807.59491.naylor.b.david@gmail.com> <20101019081824.GB54147@onelab2.iet.unipi.it> In-Reply-To: <20101019081824.GB54147@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2844468.XcjDmbjXDk"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201010201938.58687.naylor.b.david@gmail.com> Cc: freebsd-current@freebsd.org, Miroslav Lachman <000.fbsd@quip.cz> Subject: Re: geom_sched usage X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Oct 2010 17:39:12 -0000 --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--