Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/kern



On Thu, Jun 02, 2011 at 09:21:11PM +0100, David Laight wrote:
 > Actually I've thought about this some more.
 > While, on the face of it, removing the 'struct lwp *' parameter to
 > all system calls might seem an optimisation, I suspect that,
 > especially on systems where arguments are passed in registers, it
 > is a pessimisation.

I doubt it. It's not actually particularly useful to pass around
curlwp unless you pass it around *everywhere*.

Meanwhile, on systems where arguments are passed in registers, at
least in theory if you don't need to insert curlwp and shift all the
other arguments over by one, you can avoid rearranging the arguments
at all in the syscall trap handler.

 > Recovering curlwp may involve a function call, and is, at best, a real
 > memory access of global data (possibly via an asm statement) that will
 > be slow and multiple accesses might need caching in a local anyway.

Not really.

We've been steadily removing the 4.4-era code for passing curproc/
curlwp around ever since we started adding real multiprocessor
support. It was added in the first place based on the belief that
retrieving curproc would be expensive in a multiprocessor world, but
this turns out not to be true. There's too much crap that accesses it,
so it's necessary to put a scheme in place to make it fast.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index