From: David Mosberger <davidm@napali.hpl.hp.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: davidm@hpl.hp.com, linux-kernel@vger.kernel.org,
torvalds@transmeta.com, ak@suse.de
Subject: Re: per_cpu fixes
Date: Thu, 10 Jul 2003 10:55:06 -0700 [thread overview]
Message-ID: <16141.43130.657025.952793@napali.hpl.hp.com> (raw)
In-Reply-To: <20030710015208.1E7A22C44B@lists.samba.org>
>>>>> On Thu, 10 Jul 2003 11:41:07 +1000, Rusty Russell <rusty@rustcorp.com.au> said:
Rusty> A compromise is possible. I believe that the address of a
Rusty> per-cpu variable *must* be the same everywhere, but we can
Rusty> provide get & set macros which never expose an lvalue, and on
Rusty> IA64 could use the pinned TLB thing:
Rusty> /* Usage: set_cpu_local(myint, = 1), or set_cpu_local(mystruct,.member = 1) */
Rusty> #define set_cpu_local(var, assign) ...
Rusty> /* Usage: get_cpu_local(myint), or get_cpu_local(mystruct).member */
Rusty> #define get_cpu_local(var)
Rusty> ...
You mean there would be three primitives:
(1) get value from a per-CPU variable
(2) set value of a per-CPU variable
(3) get the (canonical) address of a per-CPU variable
?
If so, I could live with that.
I don't like the proposed syntax for (2) very much, but I don't have a
better suggestion and it may not matter much: for extremely
performance-critical stuff (2) can be used and if you really hate the
syntax, you can use (3) to get a pointer to the variable and then do
the normal thing.
On ia64, we should be able to implement (3) via a CPU-local variable
which stores the per-CPU offset for a CPU. Ideally, calculating the
canonical address of CPU-local variable FOO would boil down to:
movl ADDR = local_per_cpu_offset;;
load ADDR = [ADDR];; // read the per-CPU offset
addl ADDR = (FOO - local_per_cpu_offset), ADDR // calculate local addr of FOO
I'm not sure we can coax gcc to generate exactly this code, but we
should be able to get close and should definitely be able to avoid an
array lookup and accessing remote memory (in the NUMA case).
I suspect Andi could do something similar?
--david
next prev parent reply other threads:[~2003-07-10 17:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-09 21:20 David Mosberger
2003-07-09 21:56 ` David Mosberger
2003-07-10 1:41 ` Rusty Russell
2003-07-10 9:37 ` Andi Kleen
2003-07-10 17:55 ` David Mosberger [this message]
2003-07-10 18:15 ` Linus Torvalds
2003-07-10 18:22 ` David Mosberger
2003-07-11 2:01 ` Rusty Russell
2003-07-11 2:08 ` David Mosberger
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=16141.43130.657025.952793@napali.hpl.hp.com \
--to=davidm@napali.hpl.hp.com \
--cc=ak@suse.de \
--cc=davidm@hpl.hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@transmeta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®