From owner-cvs-all Sat Jan 18 7:42:17 2003 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1CFE037B401; Sat, 18 Jan 2003 07:42:14 -0800 (PST) Received: from angelica.unixdaemons.com (angelica.unixdaemons.com [209.148.64.135]) by mx1.FreeBSD.org (Postfix) with ESMTP id 39FF543F13; Sat, 18 Jan 2003 07:42:13 -0800 (PST) (envelope-from hiten@angelica.unixdaemons.com) Received: from angelica.unixdaemons.com (hiten@localhost.unixdaemons.com [127.0.0.1]) by angelica.unixdaemons.com (8.12.7/8.12.1) with ESMTP id h0IFgBa6005779; Sat, 18 Jan 2003 10:42:11 -0500 (EST) Received: (from hiten@localhost) by angelica.unixdaemons.com (8.12.7/8.12.1/Submit) id h0IFgBal005778; Sat, 18 Jan 2003 10:42:11 -0500 (EST) (envelope-from hiten) Date: Sat, 18 Jan 2003 10:42:11 -0500 From: Hiten Pandya To: Robert Watson Cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/share/man/man9 malloc.9 mbuf.9 Message-ID: <20030118154211.GB96568@unixdaemons.com> References: <200301180325.h0I3PeQ2012280@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200301180325.h0I3PeQ2012280@repoman.freebsd.org> User-Agent: Mutt/1.4i X-Operating-System: FreeBSD i386 X-Public-Key: http://www.pittgoth.com/~hiten/pubkey.asc X-URL: http://www.unixdaemons.com/~hiten X-PGP: http://pgp.mit.edu:11371/pks/lookup?search=Hiten+Pandya&op=index Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Jan 17, 2003 at 07:25:40PM -0800, Robert Watson wrote the words in effect of: > rwatson 2003/01/17 19:25:40 PST > > Modified files: > share/man/man9 malloc.9 mbuf.9 > Log: > Caution programmers not to confuse M_DONTWAIT with M_NOWAIT. They > are not the same. > > Suggested by: Hiten Pandya Thanks! It would also be good, if the inline patch was committed too; there was a discussion about this some weeks ago, and Alfred wanted it documented. It will be appreciated. Cheers. Index: malloc.9 =================================================================== RCS file: /home/ncvs/src/share/man/man9/malloc.9,v retrieving revision 1.24 diff -u -r1.24 malloc.9 --- malloc.9 2002/12/24 16:52:31 1.24 +++ malloc.9 2003/01/04 08:24:00 @@ -229,8 +229,25 @@ For larger requests, one or more pages is allocated. While it should not be relied upon, this information may be useful for optimizing the efficiency of memory use. +.Pp +Malloc flags documented above should +.Em NOT +be used with +.Xr mbuf 9 +routines; It is a very common mis-understanding, and can have +undesired results. +.Pp +Any calls to +.Fn malloc +or +.Fn free +when holding a +.Xr vnode 9 +interlock, will cause a LOR (Lock Order Reversal) due to the +interwining of VM Objects and Vnodes. .Sh SEE ALSO .Xr vmstat 8 +.Xr vnode 9 .Sh DIAGNOSTICS A kernel compiled with the .Dv DIAGNOSTIC Index: vnode.9 =================================================================== RCS file: /home/ncvs/src/share/man/man9/vnode.9,v retrieving revision 1.21 diff -u -r1.21 vnode.9 --- vnode.9 2002/12/12 17:25:58 1.21 +++ vnode.9 2003/01/04 08:24:01 @@ -45,18 +45,6 @@ enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; /* - * Vnode tag types. - * These are for the benefit of external programs only (e.g., pstat) - * and should NEVER be inspected by the kernel. - */ -enum vtagtype { - VT_NON, VT_UFS, VT_NFS, VT_UNUSED, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, - VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, - VT_UNION, VT_MSDOSFS, VT_DEVFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS, - VT_HPFS, VT_NWFS, VT_PSEUDOFS -}; - -/* * Each underlying file system allocates its own private area and hangs * it from v_data. If non-null, this area is freed in getnewvnode(). */ @@ -105,7 +93,7 @@ struct vm_object *v_object; /* Place to store VM object */ struct simplelock v_interlock; /* lock on usecount and flag */ struct lock *v_vnlock; /* used for non-locking fs's */ - enum vtagtype v_tag; /* type of underlying data */ + const char *v_tag; /* type of underlying data */ void *v_data; /* private data for fs */ LIST_HEAD(, namecache) v_cache_src; /* Cache entries from us */ TAILQ_HEAD(, namecache) v_cache_dst; /* Cache entries to us */ @@ -241,7 +229,7 @@ .It Dv VBAD An old style bad sector map .El -.Sh NOTES +.Sh IMPLEMENTATION NOTES VFIFO uses the "struct fileops" from .Pa /sys/kern/sys_pipe.c . VSOCK uses the "struct fileops" from @@ -252,7 +240,17 @@ The VFIFO/VSOCK code, which is why "struct fileops" is used at all, is an artifact of an incomplete integration of the VFS code into the kernel. +.Pp +Calls to +.Xr malloc 9 +or +.Xr free 9 +when holding a +.Nm +interlock, will cause a LOR (Lock Order Reversal) due to the +interwining of VM Objects and Vnodes. .Sh SEE ALSO +.Xr malloc 9 .Xr VFS 9 .Sh AUTHORS This man page was written by P.S. The second patch is for removing the vtagtype information, as it is invalid now. -- Hiten Pandya (hiten@unixdaemons.com, hiten@uk.FreeBSD.org) http://www.unixdaemons.com/~hiten/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message