List Info

Thread: MIPS curlwp




MIPS curlwp
country flaguser name
United Kingdom
2007-03-30 09:39:42
Hi,

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.

Thoughts?

Andrew

Re: MIPS curlwp
country flaguser name
United Kingdom
2007-04-04 16: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

Re: MIPS curlwp
country flaguser name
United States
2007-04-04 17:10:27
On Apr 4, 2007, at 2:40 PM, Andrew Doran wrote:

> 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

Cool.  BTW, if we do this, it might be good to #ifdef
_KERNEL out the  
s7 definition and call it curlwp_reg, or something like
that, to make  
it harder to use it by mistake in asm code.

-- thorpej


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )