Subject: Re: MIPS curlwp
To: None <port-mips@netbsd.org>
From: Andrew Doran <ad@netbsd.org>
List: port-mips
Date: 04/04/2007 22:40:02
On Fri, Mar 30, 2007 at 03:39:42PM +0100, Andrew Doran wrote:

> I've been making changes for MIPS on the yamt-idlelwp branch and got stung
> by the fact that there's no ci_curlwp pointer in struct cpu_info. That's
> easy to solve, but I wonder if it's useful to store the value of curlwp in
> gp or another register. That would allow defining curcpu as curlwp->l_cpu.
> 
> I think it's worthwhile doing since the new locking primitives want to know
> what curlwp is quite often, and I've slowly been coming around to the idea
> that passing "struct lwp *" about all over the place leads to confusion.

Some numbers from a pmax GENERIC kernel below. If we were to stop passing
"struct lwp *" about then it looks like there are some savings to be had.

=> with s7 as a general purpose register

-rwxr-xr-x  1 ad  staff  3781432 Apr  4 14:28 netbsd

objdump -d netbsd | grep s7 | wc -l
      99

=> with s7 as curlwp

-rwxr-xr-x  1 ad  staff  3778945 Apr  4 14:19 netbsd

objdump -d netbsd | grep s7 | wc -l
     573

Andrew