Port-mips archive

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

Re: CURLWP global register in NetBSD/mips



On Dec 21, 2010, at 11:09 AM, Simon Burge wrote:

> Matt Thomas wrote:
> 
>> On Dec 21, 2010, at 1:56 AM, Toru Nishimura wrote:
>> 
>>> Guys,
>>> 
>>> NetBSD/mips kernel uses a dedicated register to hold curlwp
>>> global variable.  Register S7 is used in -current whileT8 in
>>> matt-nb5-mips64 branch (why differ?)
>> 
>> Better code.  T8 is rarely used but S7 is one of the saved
>> registers and used much more often.
> 
> I'm curious - was the change to put curlwp ever actually benchmarked?  I
> couldn't find anything.  I can find a reference to a kernel being 2487
> bytes smaller in April 2007 but no benchmarks.

I was asked about the use of S7 early this year and came up with:

The change came from the yamt-idlelwp branch (2007-05-17) as indicated in 1.45 
of sys/arch/mips/conf/Makefile.mips.  There no explanation of how s7 was chosen.

Here's a breakdown of a MALTA64 kernel of how often each register is used.  I 
moved MIPS_CURLWP from s7 to t8 (23 to 24).  It's curious as to why one of 
t1/t2 is never used. 
s7 is now used 7524 times and the 288 uses of t8 have been moved to another 
register.

For a MALTA32 kernel:

  text    data     bss     dec     hex filename
2561855  434128  217652 3213635  310943 s7 curlwp
2537035  434672  217652 3189359  30aa6f t8 curlwp
 24820
  6205 instructions

Saves about 1% in text size.  Not a lot but for a simple change, pretty 
inpressive.


s7(23)  t8(24)
----------------
   25     25 gp
   58     58 at
  251    251 k1
  264    264 k0
  277    860 t8
  456    463 t3
         531 t2
  807        t1
  847   7524 s7
 1539   1533 t0
 2341   2301 a7
 4702   4676 a6
 5566   5528 a5
 7586   5757 s8
 9155   9149 s6
11391  11354 a4
12806  12804 s5
16909  16894 s4
20934  20930 ra
23441  23467 s3
26381  26332 a3
32974  32970 s2
34143  33753 a2
44910  44888 s1
59371  59015 a1
60367  60371 s0
81935  80425 v1
91835  91109 a0
121093 120234 sp
187080 185657 v0


Home | Main Index | Thread Index | Old Index