From owner-svn-src-all@FreeBSD.ORG Thu May 21 22:11:04 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 5AEC5106566C; Thu, 21 May 2009 22:11:04 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-fx0-f168.google.com (mail-fx0-f168.google.com [209.85.220.168]) by mx1.freebsd.org (Postfix) with ESMTP id 29CB48FC0C; Thu, 21 May 2009 22:11:02 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by fxm12 with SMTP id 12so1370328fxm.43 for ; Thu, 21 May 2009 15:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=GLARlAcMxX9QsmZ4W8huy4hSTXnEadr8ylnH+939bLc=; b=lrwgUzW3M7/huRkxVqnV0dEGbGGxtDhqA7hGmzojrrTA6fdWnf9bCmtRxdHoOT4GAB soe5CD/o9YrImo+VQARraXKV4TPoCBgCTKC+RKmHFgbxwzAvIqQJhN6nZ7na9jYw2KOB BKxTb7krk2VotSkE0iWzOnS2mLvI08OOUg3IA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=ah6EeHfnIq0bprhP9GIm990vkCHANmeLLljQ3Ia94kE+5bWHQDwATDtHH1JO68+M2V tphWy/B2kR4Lmka/C8R+COo+0lvK3qdJ4HvKweDAGBumxH0141ZyteBGxlxDTTQTV/4n Ex5wr4zwU191ur59JoOlwMTIJUzP1ij0WnvuM= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.127.8 with SMTP id e8mr1964750fas.95.1242943862090; Thu, 21 May 2009 15:11:02 -0700 (PDT) In-Reply-To: <20090521194243.GW1927@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> Date: Fri, 22 May 2009 00:11:02 +0200 X-Google-Sender-Auth: 77e60aca6acb2dbe Message-ID: <3bbf2fe10905211511g53defb6cmac45fc2469cc64f@mail.gmail.com> From: Attilio Rao To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: Thu, 21 May 2009 22:11:04 -0000 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 ne= ed >> >> >to do destroy_dev, destroy_dev_sched(9). >> >> >> >> Good to know, I'll look at destroy_dev_sched(). =C2=A0I'd rather not = have to >> >> roll my own decoupled version. =C2=A0And I understand the argument ab= out >> >> destroy_dev being a drain point for the API. =C2=A0However, what abou= t >> >> create_dev()? =C2=A0Making that non-blocking would help a lot. >> > >> > create_dev() can be made non-blocking, and this is the first argument = 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 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) >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0struct cdev *cdev; >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0struct timespec ts; >> > >> > - =C2=A0 =C2=A0 =C2=A0 cdp =3D malloc(sizeof *cdp, M_CDEVP, M_USE_RESE= RVE | M_ZERO | M_WAITOK); >> > + =C2=A0 =C2=A0 =C2=A0 cdp =3D malloc(sizeof *cdp, M_CDEVP, M_USE_RESE= RVE | M_ZERO | M_NOWAIT); >> > >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0cdp->cdp_dirents =3D &cdp->cdp_dirent0; >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0cdp->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) >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return; >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (devsw->d_flags & D_NEEDGIANT) { >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dev_unlock(); >> > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dsw2 =3D malloc(siz= eof *dsw2, M_DEVT, M_WAITOK); >> > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dsw2 =3D malloc(siz= eof *dsw2, M_DEVT, M_NOWAIT); >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dev_lock(); >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0} else >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dsw2 =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 conversion. >> I'm unable to check the code right now. > > Sure. Something like this. > At this point I wonder what's the purpose of maintaining the sleeping version for such functions? Attilio --=20 Peace can only be achieved by understanding - A. Einstein