From owner-svn-src-projects@FreeBSD.ORG Sun Aug 25 13:29:12 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 0D7F7DF5; Sun, 25 Aug 2013 13:29:12 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-ee0-x230.google.com (mail-ee0-x230.google.com [IPv6:2a00:1450:4013:c00::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 347A52D9D; Sun, 25 Aug 2013 13:29:11 +0000 (UTC) Received: by mail-ee0-f48.google.com with SMTP id l10so1097216eei.7 for ; Sun, 25 Aug 2013 06:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=lEM8wDvLwIQEnTGL09SeECBioe804q3Pm6RALsXWsBI=; b=NBzZ9fwr8GX17NmrSjwmZw3GRxwPwgKIkvXMNYsPYJ07rnRYJQnRtaT+DgU0brTqSQ d8c743N2eCH0sQOqFhWHgl8GP50699/lgsBvb1C5PhpbjeBu46I/2TwcIBV8RGuwyg5J yCeQDQvL2yhZR1arxO3J4BHXif47B7bY0+mxyGeg5NB/uX79eLsNOd4u9CG3V5dYpjOX aeZIeLkHB2RAlEK3Y6WQFfmlww5aE8Rhvt/g2hPua0mSwnQYG2vCxHkjalcMLQgddjrT krxlnA696nra+cCxuUTwBI16RSROhSbhUykYQ6MmYyat65oa5Gr/3ggmOkBNA+yMgdZf O84w== X-Received: by 10.14.111.9 with SMTP id v9mr16749089eeg.35.1377437349415; Sun, 25 Aug 2013 06:29:09 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([37.229.21.195]) by mx.google.com with ESMTPSA id k7sm14005969eeg.13.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 25 Aug 2013 06:29:08 -0700 (PDT) Sender: Alexander Motin Message-ID: <521A06A2.7050807@FreeBSD.org> Date: Sun, 25 Aug 2013 16:29:06 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130616 Thunderbird/17.0.6 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r254846 - projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs References: <201308251121.r7PBLA3v033536@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 13:29:12 -0000 On 25.08.2013 15:48, Adrian Chadd wrote: > 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 ? That sounds good to me. I was also surprised such macros are not there yet when found some code doing these checks just the same way as I did. > 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. If that status will change somehow after the check, then it is problem of that specific code, not mine. Preemption should not affect it in any way since it is property of the specific thread. > 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; > > -- Alexander Motin