From owner-svn-src-projects@FreeBSD.ORG Sun Aug 25 12:48:23 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 322C1424; Sun, 25 Aug 2013 12:48:23 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-qe0-x234.google.com (mail-qe0-x234.google.com [IPv6:2607:f8b0:400d:c02::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C41982C0B; Sun, 25 Aug 2013 12:48:22 +0000 (UTC) Received: by mail-qe0-f52.google.com with SMTP id a11so1220202qen.25 for ; Sun, 25 Aug 2013 05:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=7UkpE2LpbzV/httsCFKcqUU0rkRl7jWPZ6XWUwBDaT8=; b=S89dA+Kn+G0wklot+ib7+jhV8jyln97KthWI1ati//u/5WT33Et3rodfrXJWJLrF0h Ys7QS+ZVvT9SYWLgIUyukji/qIXMZ8A15XtMqNNwaewP0CSGxXZUplcj0nVP0Xe8MZ1s C7HNnnOqalmaCSfRJpIscBOfX3gw3VJgb3HzUCDNrIowisOSIQue88/Ty1VIMW74P8Xz tTDmUALSlse+o3QwDvS2JFoUqssD0YfIRj8GmgLDzNMU+RpENUmBrteeNkaFyrNA1vnt LDTZtzIXk49hstpug1xPyefuw8z2H/5c2RJ2Bq78+dMP5MM+eo+NIik6CLVsPlreGOCt GRRA== MIME-Version: 1.0 X-Received: by 10.224.34.68 with SMTP id k4mr10345807qad.17.1377434902011; Sun, 25 Aug 2013 05:48:22 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.128.70 with HTTP; Sun, 25 Aug 2013 05:48:21 -0700 (PDT) In-Reply-To: <201308251121.r7PBLA3v033536@svn.freebsd.org> References: <201308251121.r7PBLA3v033536@svn.freebsd.org> Date: Sun, 25 Aug 2013 05:48:21 -0700 X-Google-Sender-Auth: 9pqHSjOwYptjsrV6-8HRRRezHGc Message-ID: Subject: Re: svn commit: r254846 - projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-projects@freebsd.org, "src-committers@freebsd.org" X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Aug 2013 12:48:23 -0000 Hi, (I know this is bikeshedding, sorry!) Surely there's a better way to check whether a thread can sleep besides digging around in curthread->td_no_sleeping ? What about adding an accessor macro along side THREAD_SLEEPING_OK and THREAD_NO_SLEEPING ? I assume that td_no_sleeping won't change during the execution of a thread? (Eg if it's preempted by anything?) It looks like it's only set when doing rmlock, timeout or ithread calls, to ensure the thread doesn't sleep. Thanks, -adrian On 25 August 2013 04:21, Alexander Motin wrote: > Author: mav > Date: Sun Aug 25 11:21:10 2013 > New Revision: 254846 > URL: http://svnweb.freebsd.org/changeset/base/254846 > > Log: > Allow GEOM direct dispatch for zvol providers. Skip request handover to > the worker thread if current context allows sleeping (thanks to the > direct > dispatch in action we are not in GEOM thread). > > Together this doubles zvol performance, reaching up to 300K IOPS on my > tests. > If there would be unmapped I/O support for zvols, the above value could > be > even bigger. > > Modified: > projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c > > Modified: > projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c > > ============================================================================== > --- projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c > Sun Aug 25 11:21:03 2013 (r254845) > +++ projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c > Sun Aug 25 11:21:10 2013 (r254846) > @@ -2068,6 +2068,7 @@ zvol_geom_create(const char *name) > gp->start = zvol_geom_start; > gp->access = zvol_geom_access; > pp = g_new_providerf(gp, "%s/%s", ZVOL_DRIVER, name); > + pp->flags |= G_PF_DIRECT_RECEIVE | G_PF_DIRECT_SEND; > pp->sectorsize = DEV_BSIZE; > > zv = kmem_zalloc(sizeof(*zv), KM_SLEEP); > @@ -2171,18 +2172,20 @@ zvol_geom_start(struct bio *bp) > zvol_state_t *zv; > boolean_t first; > > + zv = bp->bio_to->private; > + ASSERT(zv != NULL); > switch (bp->bio_cmd) { > + case BIO_FLUSH: > + if (curthread->td_no_sleeping != 0) > + goto enqueue; > + zil_commit(zv->zv_zilog, ZVOL_OBJ); > + g_io_deliver(bp, 0); > + break; > case BIO_READ: > case BIO_WRITE: > - case BIO_FLUSH: > - zv = bp->bio_to->private; > - ASSERT(zv != NULL); > - mtx_lock(&zv->zv_queue_mtx); > - first = (bioq_first(&zv->zv_queue) == NULL); > - bioq_insert_tail(&zv->zv_queue, bp); > - mtx_unlock(&zv->zv_queue_mtx); > - if (first) > - wakeup_one(&zv->zv_queue); > + if (curthread->td_no_sleeping != 0) > + goto enqueue; > + zvol_strategy(bp); > break; > case BIO_GETATTR: > case BIO_DELETE: > @@ -2190,6 +2193,15 @@ zvol_geom_start(struct bio *bp) > g_io_deliver(bp, EOPNOTSUPP); > break; > } > + return; > + > +enqueue: > + mtx_lock(&zv->zv_queue_mtx); > + first = (bioq_first(&zv->zv_queue) == NULL); > + bioq_insert_tail(&zv->zv_queue, bp); > + mtx_unlock(&zv->zv_queue_mtx); > + if (first) > + wakeup_one(&zv->zv_queue); > } > > static void > @@ -2364,6 +2376,7 @@ zvol_rename_minor(struct g_geom *gp, con > g_wither_provider(pp, ENXIO); > > pp = g_new_providerf(gp, "%s/%s", ZVOL_DRIVER, newname); > + pp->flags |= G_PF_DIRECT_RECEIVE | G_PF_DIRECT_SEND; > pp->sectorsize = DEV_BSIZE; > pp->mediasize = zv->zv_volsize; > pp->private = zv; >