Date: Fri, 29 Mar 2002 11:41:58 -0800 From: Alfred Perlstein <bright@mu.org> To: John Baldwin <jhb@FreeBSD.org> Cc: arch@FreeBSD.org Subject: Re: curthread vs. passing thread pointers around Message-ID: <20020329194158.GX93885@elvis.mu.org> In-Reply-To: <XFMail.20020329143222.jhb@FreeBSD.org> References: <XFMail.20020329143222.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
* John Baldwin <jhb@FreeBSD.org> [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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020329194158.GX93885>