From owner-freebsd-arch Fri Mar 29 11:42: 2 2002 Delivered-To: freebsd-arch@freebsd.org Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by hub.freebsd.org (Postfix) with ESMTP id C3DD437B417; Fri, 29 Mar 2002 11:41:58 -0800 (PST) Received: by elvis.mu.org (Postfix, from userid 1192) id A823CAE163; Fri, 29 Mar 2002 11:41:58 -0800 (PST) Date: Fri, 29 Mar 2002 11:41:58 -0800 From: Alfred Perlstein To: John Baldwin Cc: arch@FreeBSD.org Subject: Re: curthread vs. passing thread pointers around Message-ID: <20020329194158.GX93885@elvis.mu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.27i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * John Baldwin [020329 11:32] wrote: > During a discussion on the smp@ list about changes to the suser() > API to make use of td_ucred, it was brought up that the new suser() > would be assuming that the passed in thread pointer was curthread > so why not just use curthread in suser() and not pass in a pointer > at all. There are several places in the kernel where the same > assumption is made. Thus, my question is: which general approach > should we follow, and should we perhaps switch to using explicit > curthread's everywhere and stop passing thread pointers around on > the stack? Yes and no. :) For instance, some APIs are broken such that they allow the passing of a proc/thread in, but if it isn't curproc then we die a painful death. Those functions need to stop taking a proc/thread pointer and be documented that they use the current process for cred/misc processing. It also depends on how painful/good it is to use globals, if accesses to per-cpu data are expensive then we don't want curproc/curthread if they are not then we obviously want to remove register and stack space usage by using global data. So it's a judgement call isn't it? :) -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' Tax deductible donations for FreeBSD: http://www.freebsdfoundation.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message