From owner-svn-src-all@FreeBSD.ORG Fri May 22 08:20:38 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3A241065670; Fri, 22 May 2009 08:20:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 45B688FC1C; Fri, 22 May 2009 08:20:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1M7PzX-000OWV-CJ; Fri, 22 May 2009 11:20:35 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n4M8KWrZ090462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 22 May 2009 11:20:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n4M8KWVl078906; Fri, 22 May 2009 11:20:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n4M8KWxL078905; Fri, 22 May 2009 11:20:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 22 May 2009 11:20:31 +0300 From: Kostik Belousov To: Attilio Rao Message-ID: <20090522082031.GY1927@deviant.kiev.zoral.com.ua> 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> <20090521163846.GT1927@deviant.kiev.zoral.com.ua> <3bbf2fe10905211005m350dc4d1yed6dc1b79f1603d9@mail.gmail.com> <20090521194243.GW1927@deviant.kiev.zoral.com.ua> <3bbf2fe10905211511g53defb6cmac45fc2469cc64f@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="t98UOKzcpBZ5uth4" Content-Disposition: inline In-Reply-To: <3bbf2fe10905211511g53defb6cmac45fc2469cc64f@mail.gmail.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.1 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1M7PzX-000OWV-CJ c5644d3e242cb7d4edd54e6514cd1e65 X-Terabit: YES Cc: Scott Long , src-committers@freebsd.org, John Baldwin , svn-src-all@freebsd.org, rwatson@freebsd.org, svn-src-head@freebsd.org, "M. Warner Losh" Subject: Re: svn commit: r192535 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 May 2009 08:20:39 -0000 --t98UOKzcpBZ5uth4 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 22, 2009 at 12:11:02AM +0200, Attilio Rao wrote: > 2009/5/21 Kostik Belousov : > > On Thu, May 21, 2009 at 07:05:17PM +0200, Attilio Rao wrote: > >> 2009/5/21 Kostik Belousov : > >> > 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). > >> >> > >> >> Good to know, I'll look at destroy_dev_sched(). =9AI'd rather not h= ave to > >> >> roll my own decoupled version. =9AAnd I understand the argument abo= ut > >> >> destroy_dev being a drain point for the API. =9AHowever, what about > >> >> create_dev()? =9AMaking that non-blocking would help a lot. > >> > > >> > create_dev() can be made non-blocking, and this is the first argumen= t pro > >> > Attilio patch. > >> > > >> > From the quick look, all that is needed is to replace M_WAITOK with > >> > M_NOWAIT inside prep_cdevsw() and devfs_alloc(). Untested patch belo= w. > >> > > >> > 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) > >> > =9A =9A =9A =9Astruct cdev *cdev; > >> > =9A =9A =9A =9Astruct timespec ts; > >> > > >> > - =9A =9A =9A cdp =3D malloc(sizeof *cdp, M_CDEVP, M_USE_RESERVE | M= _ZERO | M_WAITOK); > >> > + =9A =9A =9A cdp =3D malloc(sizeof *cdp, M_CDEVP, M_USE_RESERVE | M= _ZERO | M_NOWAIT); > >> > > >> > =9A =9A =9A =9Acdp->cdp_dirents =3D &cdp->cdp_dirent0; > >> > =9A =9A =9A =9Acdp->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) > >> > =9A =9A =9A =9A =9A =9A =9A =9Areturn; > >> > =9A =9A =9A =9Aif (devsw->d_flags & D_NEEDGIANT) { > >> > =9A =9A =9A =9A =9A =9A =9A =9Adev_unlock(); > >> > - =9A =9A =9A =9A =9A =9A =9A dsw2 =3D malloc(sizeof *dsw2, M_DEVT, = M_WAITOK); > >> > + =9A =9A =9A =9A =9A =9A =9A dsw2 =3D malloc(sizeof *dsw2, M_DEVT, = M_NOWAIT); > >> > =9A =9A =9A =9A =9A =9A =9A =9Adev_lock(); > >> > =9A =9A =9A =9A} else > >> > =9A =9A =9A =9A =9A =9A =9A =9Adsw2 =3D NULL; > >> > >> You need to check return values here if it returns NULL. > >> > >> IMHO, having a non-sleepable version of destroy_dev(), create_dev() > >> and such would be ideal. > >> Ideally, we should resolve all the sleeping point and do the conversio= n. > >> I'm unable to check the code right now. > > > > Sure. Something like this. > > >=20 > At this point I wonder what's the purpose of maintaining the sleeping > version for such functions? They cannot fail, thus behaving in the way that all present consumers of the function expect. --t98UOKzcpBZ5uth4 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkoWYE8ACgkQC3+MBN1Mb4ioaQCfU7KJRTPQ5cKp8BV9aRbGsiPY mi4An0q+muWTo/XGL1/jHbmCDJ4neCvX =+Ly2 -----END PGP SIGNATURE----- --t98UOKzcpBZ5uth4--