Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 May 2009 19:38:46 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Scott Long <scottl@samsco.org>
Cc:        src-committers@freebsd.org, John Baldwin <jhb@freebsd.org>, svn-src-all@freebsd.org, attilio@freebsd.org, rwatson@freebsd.org, svn-src-head@freebsd.org, "M. Warner Losh" <imp@bsdimp.com>
Subject:   Re: svn commit: r192535 - head/sys/kern
Message-ID:  <20090521163846.GT1927@deviant.kiev.zoral.com.ua>
In-Reply-To: <4A157FF3.8020408@samsco.org>
References:  <3bbf2fe10905210629p46c7a204v6863aaba77354462@mail.gmail.com> <20090521.094100.70797067.imp@bsdimp.com> <4A157919.7040103@samsco.org> <200905211211.00168.jhb@freebsd.org> <20090521161535.GQ1927@deviant.kiev.zoral.com.ua> <4A157FF3.8020408@samsco.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--d5xRKMqY7hkGAt+u
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, May 21, 2009 at 09:23:15AM -0700, Scott Long wrote:
> Kostik Belousov wrote:
> >We do have the KPI for the callers that cannot drop the locks and need
> >to do destroy_dev, destroy_dev_sched(9).
>=20
> Good to know, I'll look at destroy_dev_sched().  I'd rather not have to
> roll my own decoupled version.  And I understand the argument about
> destroy_dev being a drain point for the API.  However, what about
> create_dev()?  Making that non-blocking would help a lot.

create_dev() can be made non-blocking, and this is the first argument pro
Attilio patch.

=46rom the quick look, all that is needed is to replace M_WAITOK with
M_NOWAIT inside prep_cdevsw() and devfs_alloc(). Untested patch below.

diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c
index 4041911..f470ee8 100644
--- a/sys/fs/devfs/devfs_devs.c
+++ b/sys/fs/devfs/devfs_devs.c
@@ -120,7 +120,7 @@ devfs_alloc(void)
 	struct cdev *cdev;
 	struct timespec ts;
=20
-	cdp =3D malloc(sizeof *cdp, M_CDEVP, M_USE_RESERVE | M_ZERO | M_WAITOK);
+	cdp =3D malloc(sizeof *cdp, M_CDEVP, M_USE_RESERVE | M_ZERO | M_NOWAIT);
=20
 	cdp->cdp_dirents =3D &cdp->cdp_dirent0;
 	cdp->cdp_dirent0 =3D NULL;
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index 284f482..acdd44a 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -559,7 +559,7 @@ prep_cdevsw(struct cdevsw *devsw)
 		return;
 	if (devsw->d_flags & D_NEEDGIANT) {
 		dev_unlock();
-		dsw2 =3D malloc(sizeof *dsw2, M_DEVT, M_WAITOK);
+		dsw2 =3D malloc(sizeof *dsw2, M_DEVT, M_NOWAIT);
 		dev_lock();
 	} else
 		dsw2 =3D NULL;

--d5xRKMqY7hkGAt+u
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkoVg5UACgkQC3+MBN1Mb4gjKgCg8S3EaQZX3mKrL95vcj9m2Pgy
18kAoIsgBfEGPBrUSxw+nOaX7+xQrtBO
=kPkC
-----END PGP SIGNATURE-----

--d5xRKMqY7hkGAt+u--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090521163846.GT1927>