From owner-cvs-all Tue Dec 31 21:52:14 2002 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 A399837B401; Tue, 31 Dec 2002 21:52:12 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4180943EC5; Tue, 31 Dec 2002 21:52:11 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id QAA23527; Wed, 1 Jan 2003 16:52:08 +1100 Date: Wed, 1 Jan 2003 16:54:17 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: "Brian F. Feldman" Cc: Nate Lawson , Alan Cox , , Subject: Re: cvs commit: src/sys/vm vm_map.c vm_map.h In-Reply-To: <200212312121.gBVLLKNX013666@green.bikeshed.org> Message-ID: <20030101163629.O55844-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Tue, 31 Dec 2002, Brian F. Feldman wrote: > Nate Lawson wrote: > > On Tue, 31 Dec 2002, Alan Cox wrote: > > > [...] > > > - lockmgr(&map->lock, LK_RELEASE, NULL, curthread); > > > + if (map->system_map) > > > + _mtx_unlock_flags(&map->system_mtx, 0, file, line); > > > + else > > > + lockmgr(&map->lock, LK_RELEASE, NULL, curthread); > > > } > > > > > > void > > > > Please use the non-underscore, exported mtx_* routines. The macros expand > > to the same thing unless you're doing something strange w/ file and line > > (but I don't see that in your patch). > > They're in-line functions, so the file and line numbers are entirely useless > if you don't pass them in directly, and used the macros. That would be another bug (if they were inline functions), but they are actually ordinary functions which are passed file and line args. In other words, they do do something strange w/ file and line. It may be another bug that they don't do something strange with __func__ -- the function name is for the ordinary function, not the caller, so it is unrelated to the file and line and not very interesting. This is part of the bug that file and line are only used for the mtx locks. They are not used for lockmgr locks or passed to KASSERT()s. KASSERT() uses __FILE_ and __LINE_ internally but we pass __func__ to it. The mtx macros are more flexible and pessimized. Until this commit, most things used lockmgr locks and file and line were mostly unused. I really dislike passing around file, line, __FILE__, __LINE__ and __func__. They can be determined from the program counter in most cases given some debugging info. Passing them unconditionally pessimizes even cases where they aren't used (when INVARIANTS is not configured, etc), and passing them conditional on debugging options gives complications (see sys/mutex.h). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message