From owner-freebsd-current Mon Feb 11 19:38:15 2002 Delivered-To: freebsd-current@freebsd.org Received: from newman2.bestweb.net (newman2.bestweb.net [209.94.102.67]) by hub.freebsd.org (Postfix) with ESMTP id 5985137B68A; Mon, 11 Feb 2002 18:19:30 -0800 (PST) Received: from okeeffe.bestweb.net (okeefe.bestweb.net [209.94.100.110]) by newman2.bestweb.net (Postfix) with ESMTP id 1D1302332F; Mon, 11 Feb 2002 21:18:22 -0500 (EST) Received: by okeeffe.bestweb.net (Postfix, from userid 0) id 9EDF69F408; Mon, 11 Feb 2002 21:12:51 -0500 (EST) Date: Mon, 11 Feb 2002 15:39:35 -0800 From: Alfred Perlstein To: Julian Elischer Cc: jhb@freebsd.org, bde@freebsd.org, current@freebsd.org Subject: Re: ucred holding patch, BDE version Message-Id: <20020212021251.9EDF69F408@okeeffe.bestweb.net> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Julian Elischer [020211 15:00] wrote: > In the current world, when the thread enters userland, it does: > > lock giant > crfree() (which includes mutexes) > unlock giant This isn't needed afaik. > if there are ASTs it does this once again for each AST waiting as well. > > And on the way into the system it does: > lock process > crhold() (which includes mutex ops) > unlock process This isn't needed, at least afaik. > so if there is a single AST (not uncommon) it does on a system call, 4 to > 6 locks and 4 to 6 unlocks just to get a reference on the ucred it already > had a reference on. By not freeing it when going to userland, and checking > if it is the right one when returning to the kernel, we replace that with > a pointer comparison (well maybe 2) 99.999% of the time. > > John still wants to free it if INVARIANTS is on so he canh trap on > inapropriate access. I'm not sure it's needed but am willing to do so.. This makes little sense to me. Maybe I'm missing something, but by virtue of ownership we don't have to worry about the ucred's refcount on entry into the kernel because it is the owner and no one else is allowed to change our privledges besideds ourselves via set[ug]id(). Therefore the additional hold on entry is completely useless no matter what and with that the release on exit is also useless. -Alfred To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message