All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Tinga Shilo <tingashilo@yahoo.com>
Cc: linux-mips@linux-mips.org
Subject: Re: static variables access and gp
Date: Sun, 9 Mar 2003 14:46:26 +0100	[thread overview]
Message-ID: <20030309144625.A27651@linux-mips.org> (raw)
In-Reply-To: <20030306073017.65521.qmail@web41509.mail.yahoo.com>; from tingashilo@yahoo.com on Wed, Mar 05, 2003 at 11:30:17PM -0800

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

      parent reply	other threads:[~2003-03-09 13:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030309144625.A27651@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=linux-mips@linux-mips.org \
    --cc=tingashilo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.