From owner-freebsd-current@FreeBSD.ORG Tue Oct 19 06:08:09 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 B6762106564A for ; Tue, 19 Oct 2010 06:08:09 +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 314EB8FC15 for ; Tue, 19 Oct 2010 06:08:08 +0000 (UTC) Received: by wyb38 with SMTP id 38so2153473wyb.13 for ; Mon, 18 Oct 2010 23:08:08 -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=6jO9QKkmMtgS7JW12kIu6agVG6mVHzu7HHln5TJapxQ=; b=XCoeaIlMRgbTyXZm/wVKwBQxc7sqru5fhrjUaajuqT8f3mhWQu8FFUBmHCqtC+qLoj 8KNDtVabIsXM/FCNvBLMBLCrajxxZob+mB7PGS/Ffuq07jJqBHyEZgV/PWdyYhpUWGO9 40k3pLNGxXC2p/K6N0qcVbvPy3LbBx/W/2FAA= 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=KIW/SOfokfh2AMHs9htBia3FFpzJ5p8hrKLkqCpgA3S6cvtDCGZ5svAww0y0H3ZWnq IHAQvRZBMveosuMg7E82l0FlOsrVEYUSngLtZpH9nauS742rmGQLAU/ze+Nu/iIuxT/U /2LaJ9JfeXYVy5T45gEzCdSnz0SwigA8lywEc= Received: by 10.227.63.15 with SMTP id z15mr5420317wbh.214.1287468487955; Mon, 18 Oct 2010 23:08:07 -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 x65sm7382273weq.25.2010.10.18.23.08.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 18 Oct 2010 23:08:06 -0700 (PDT) From: David Naylor To: Luigi Rizzo Date: Tue, 19 Oct 2010 08:07: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> <20101018195125.GA46115@onelab2.iet.unipi.it> In-Reply-To: <20101018195125.GA46115@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart4209501.PVuBcdrAFh"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201010190807.59491.naylor.b.david@gmail.com> Cc: freebsd-current@freebsd.org 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: Tue, 19 Oct 2010 06:08:09 -0000 --nextPart4209501.PVuBcdrAFh Content-Type: multipart/mixed; boundary="Boundary-01=_7WTvMoIkzLmYVWS" Content-Transfer-Encoding: 7bit --Boundary-01=_7WTvMoIkzLmYVWS Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Monday 18 October 2010 21:51:25 Luigi Rizzo wrote: > On Mon, Oct 18, 2010 at 09:43:28AM +0200, David Naylor wrote: > > Hi, > >=20 > > I've used geom_sched to some success. Normally I do not notice anything > > but today I was copying big files over a gigabit ethernet and my laptop > > was not very responsive. I loaded gsched and the responsiveness > > improved (although still rather bad for anything requiring something > > from the HDD). > >=20 > > Thank you for all this work :-) > >=20 > > Some questions I have: > > - with a gmirror should the gsched be attached to the underlying devic= es > > (aka > >=20 > > /dev/ad?) or to the mirror device (aka /dev/mirror/?)? >=20 > always attach as close as possible to the hardware. Thanks. =20 > > - is there anyway to automatically attach gsched to a device on startup > > (i.e. > >=20 > > in rc.conf)? >=20 > no, you have to build some script yourself. Would there be any interest in having a rc.d/ script? I would find it=20 conveniant to specify a single rc.conf line and get scheduling for all my=20 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 in= to=20 shape. =20 > > - is there a way to prioritise random IO (vs sequential reads from big > >=20 > > files)? >=20 > no way to do that, but you can modify the quantum size and time to > let sequential reads get shorter chunks >=20 > kern.geom.sched.rr.quantum_kb: 8192 > kern.geom.sched.rr.quantum_ms: 100 > kern.geom.sched.rr.wait_ms: 10 >=20 > e.g. on a laptop it might make sense to set > quantum_ms=3D50 and quantum_kb=3D2048 Is there a manual page that describes these sysctls? It looks like, in my= =20 case, scp just hogs resources. =20 I do perceive some improvements in normal usage. Thanks > > - gsched_as does not appear to be installed. >=20 > true, gsched_as was just a proof of concept and gsched_rr > includes anticipation and round robin, so it is a superset of gsched_as Thanks for clarity. Regards, David --Boundary-01=_7WTvMoIkzLmYVWS 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. If empty all # storage devices are used # # gsched_$dev specifies the sheduling algorithm to use (e.g. `rr') # TODO: # - add gsched profiles, such as `desktop' for kern.geom.sched.rr tunables # 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_start_dev() { local _gsched_dev _gsched_profile _gsched_args _gsched_dev=3D$1 # Check if sched algo was specified # eval _gsched_profile=3D\$gsched_${_gsched_dev} if [ -n "${_gsched_profile}" ]; then _gsched_args=3D"-a ${_gsched_profile}" fi =09 # Start gsched for ${_gsched_dev} ${command} insert ${_gsched_args} ${_gsched_dev} } gsched_all_devs() { local _dev # Only supports upto 100 devices per device class # XXX: what other storage devices are there? for _dev in `cd /dev; echo *`; do case ${_dev} in ad[0-9]|ad[0-9][0-9]) echo ${_dev} ;; ada[0-9]|ada[0-9][0-9]) echo ${_dev} ;; da[0-9]|da[0-9][0-9]) echo ${_dev} ;; esac done } gsched_start() { local _gsched_devs _g _gsched_devs_recon _gsched_devs=3D$* if [ -z "${_gsched_devs}" ]; then # Use devices specified by gsched_devs _gsched_devs=3D${gsched_devs} # If no devices are specified then use all we can find if [ -z "${_gsched_devs}" ]; then _gsched_devs=3D`gsched_all_devs` fi elif [ -n "${gsched_devs}" ]; then # Make sure the custom device is one of the accepted for _g in ${_gsched_devs}; do case ${gsched_devs} in # _g is either by itself, at the start, middle # or the end of gsched_devs ${_g}|${_g}\ *|*\ ${_g}\ *|*\ ${_g}) _gsched_devs_recon=3D"${_gsched_devs_recon} ${_g}" ;; esac done _gsched_devs=3D${_gsched_devs_recon} fi echo -n "Starting gsched devices:" for _g in ${_gsched_devs}; do echo -n " $_g" gsched_start_dev $_g done echo "." } gsched_stop_dev() { local _gsched_dev _gsched_dev=3D$1 ${command} destroy ${_gsched_dev}.sched. } gsched_stop() { local _gsched_devs _g _gsched_devs=3D$* if [ -z "${_gsched_devs}" ]; then # Use devices specified by gsched_devs _gsched_devs=3D${gsched_devs} # If no devices are specified then use all we can find if [ -z "${_gsched_devs}" ]; then _gsched_devs=3D`gsched_all_devs` fi fi echo -n "Stopping gsched devices:" for _g in ${_gsched_devs}; do echo -n " $_g" gsched_stop_dev $_g done echo "." } load_rc_config $name run_rc_command $* --Boundary-01=_7WTvMoIkzLmYVWS-- --nextPart4209501.PVuBcdrAFh 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) iEYEABECAAYFAky9Nb8ACgkQUaaFgP9pFrJ14ACfRTmC+Z7Zw2VwWe02A93OcAdW SOQAnRzJMtyMUd6eM0EVZLVG3/HNdpmm =wvam -----END PGP SIGNATURE----- --nextPart4209501.PVuBcdrAFh--