Subject: Re: Pulling simple syscalls out from the giant lock
To: Tonnerre <tonnerre@thundrix.ch>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-kern
Date: 06/07/2005 14:08:12
On Tue, Jun 07, 2005 at 07:59:15PM +0200, Tonnerre wrote:
> Salut,
>
> On Tue, Jun 07, 2005 at 01:41:23PM -0400, Thor Lancelot Simon wrote:
> > > Yes. The MD syscall code checks for the SYSCALL_MPSAFE flag and
> > > doesn't take the big-lock if it's set. It's currently only set for
> > > getpid(). Exactly what else it could be easily applied to is less
> > > clear; getpid() is the only true no-brainer that requires taking no
> > > locks on anything at all.
> >
> > The vnode locks needed for getcwd() certainly _ought_ to be MP-safe,
> > no? What's the point of having them there if they aren't?
> >
> > The other one that comes immediately to mind, though, is gettimeofday().
> > Oh, and getppid() and getrlimit(), maybe.
>
> Well, gettimeofday() is so easy that in Linux it is done entirely in userland;
> the kernel is mapping a shared page to some place, and every process that does
> gettimeofday() reads the variable and returns, with no context switching
I think this technique actually originally comes from either Darwin or
Solaris. In any event, it's something we've been talking about doing
for some time.
However, in the interim, we could mark gettimeofday() MPSAFE, and since
we will need to keep the compatibility versions of that syscall around
indefinitely, we should mark them, too.
--
Thor Lancelot Simon tls@rek.tjls.com
"The inconsistency is startling, though admittedly, if consistency is to be
abandoned or transcended, there is no problem." - Noam Chomsky