static variables access and gp
Hi,
I am implementing a kernel mechanism which is very performance oriented. Along my long critical path,
there is a static variable that needs to be accessed quite a few times. This variable is a structure which is approximately 60 bytes big.
In there any way I can "convince" my kernel (compiled with gcc) to access this variable using gp ? Is gp usually used for this purpose in mips-linux ? Can it be ?
A while ago I saw a small discussion here about usage of gp for static variables, but it didn't provide any definite answers.
TIA
T
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
Quoted 12 lines · Tinga Shilo
Hi,
I am implementing a kernel mechanism which is very performance oriented. Along my long critical path,
there is a static variable that needs to be accessed quite a few times. This variable is a structure which is approximately 60 bytes big.
In there any way I can "convince" my kernel (compiled with gcc) to access this variable using gp ? Is gp usually used for this purpose in mips-linux ? Can it be ?
No. gp is used by kernel to hold current process in 2.4 and current thread in 2.5. Don't mess with it unless you are absolutely sure what you are doing.
Jun
Thx. Got it.
Any other solution to speed up the access to this variable ? It's location never changes from kernel init to shutdown if I haven't made that clear.
Quoted 19 lines · --- Jun Sun
Quoted 5 lines · Tinga Shilo
Hi,
I am implementing a kernel mechanism which is very performance oriented. Along my long critical path,
there is a static variable that needs to beaccessed
Quoted 1 line
quite a few times. This variable is a structure
which
Quoted 2 lines
is approximately 60 bytes big.
In there any way I can "convince" my kernel(compiled
Quoted 2 lines
with gcc) to access this variable using gp ? Is gp usually used for this purpose in mips-linux
?
Quoted 2 lines
Can it be ?
Quoted 7 lines
No. gp is used by kernel to hold current process in 2.4
and current thread in 2.5. Don't mess with it unless
you are absolutely sure what you are doing.Jun
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
Quoted 11 lines · Tinga Shilo
I am implementing a kernel mechanism which is very performance oriented. Along my long critical path,
there is a static variable that needs to be accessed quite a few times. This variable is a structure which is approximately 60 bytes big.
In there any way I can "convince" my kernel (compiled with gcc) to access this variable using gp ? Is gp usually used for this purpose in mips-linux ? Can it be ?
Quoted 3 lines
A while ago I saw a small discussion here about usage of gp for static variables, but it didn't provide any definite answers.
Use a pointer to the that structure. Gcc will keep this pointer in a registers wherever it considers that sensible. Any reference to members of the structure can then be made with just a single instruction.
$28 is used for the current pointer so only suitable for per-process data.
Ralf