* static variables access and gp
@ 2003-03-06 7:30 Tinga Shilo
2003-03-06 17:40 ` Jun Sun
2003-03-09 13:46 ` Ralf Baechle
0 siblings, 2 replies; 5+ messages in thread
From: Tinga Shilo @ 2003-03-06 7:30 UTC (permalink / raw)
To: linux-mips
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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: static variables access and gp
2003-03-06 7:30 static variables access and gp Tinga Shilo
@ 2003-03-06 17:40 ` Jun Sun
2003-03-09 7:24 ` Tinga Shilo
2003-03-09 13:46 ` Ralf Baechle
1 sibling, 1 reply; 5+ messages in thread
From: Jun Sun @ 2003-03-06 17:40 UTC (permalink / raw)
To: Tinga Shilo; +Cc: linux-mips, jsun
On Wed, Mar 05, 2003 at 11:30:17PM -0800, Tinga Shilo wrote:
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: static variables access and gp
2003-03-06 17:40 ` Jun Sun
@ 2003-03-09 7:24 ` Tinga Shilo
2003-03-09 7:24 ` Tinga Shilo
0 siblings, 1 reply; 5+ messages in thread
From: Tinga Shilo @ 2003-03-09 7:24 UTC (permalink / raw)
To: Jun Sun; +Cc: linux-mips, jsun
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.
--- Jun Sun <jsun@mvista.com> wrote:
> On Wed, Mar 05, 2003 at 11:30:17PM -0800, Tinga
> Shilo wrote:
> > 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
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: static variables access and gp
2003-03-09 7:24 ` Tinga Shilo
@ 2003-03-09 7:24 ` Tinga Shilo
0 siblings, 0 replies; 5+ messages in thread
From: Tinga Shilo @ 2003-03-09 7:24 UTC (permalink / raw)
To: Jun Sun; +Cc: linux-mips
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.
--- Jun Sun <jsun@mvista.com> wrote:
> On Wed, Mar 05, 2003 at 11:30:17PM -0800, Tinga
> Shilo wrote:
> > 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
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: static variables access and gp
2003-03-06 7:30 static variables access and gp Tinga Shilo
2003-03-06 17:40 ` Jun Sun
@ 2003-03-09 13:46 ` Ralf Baechle
1 sibling, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2003-03-09 13:46 UTC (permalink / raw)
To: Tinga Shilo; +Cc: linux-mips
On Wed, Mar 05, 2003 at 11:30:17PM -0800, Tinga Shilo wrote:
> 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.
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-03-09 13:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-06 7:30 static variables access and gp Tinga Shilo
2003-03-06 17:40 ` Jun Sun
2003-03-09 7:24 ` Tinga Shilo
2003-03-09 7:24 ` Tinga Shilo
2003-03-09 13:46 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox