From: Manfred Spraul <manfred@colorfullife.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Benjamin LaHaise <bcrl@redhat.com>,
Linus Torvalds <torvalds@transmeta.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Arjan Van de Ven <arjanv@redhat.com>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] take 2 of the tr-based current
Date: Fri, 09 Nov 2001 15:54:03 +0100 [thread overview]
Message-ID: <3BEBEE0B.BA1FD7EE@colorfullife.com> (raw)
In-Reply-To: <20011108190546.A29741@redhat.com> <20011108211143.A4797@redhat.com> <20011109041327.T4087@devserv.devel.redhat.com>
Jakub Jelinek wrote:
>
> On Thu, Nov 08, 2001 at 09:11:43PM -0500, Benjamin LaHaise wrote:
> > -static unsigned get_TR(void) __attribute__ ((pure))
> > +static unsigned get_TR(void) __attribute__ ((pure));
> > +static unsigned get_TR(void)
> > {
> > unsigned tr;
> > __asm__("str %w0" : "=g" (tr));
>
> Why not
> static inline unsigned __attribute__ ((const)) get_TR(void)
> {
> }
> ?
> If TR register only ever changes during cpu_init, I don't see why you
> cannot use const.
The task register is only pure, not const. It's true that it's only
initialized during cpu_init(), but different cpus in the system have
different task register values.
get_TR();
schedule();
get_TR();
must reload the task register.
But the value of "current" can be considered as const: It never changes
for a running thread. The exception are fork() and clone(), but both
functions directly call asm code and run on a fresh stack after forking.
> Using pure would mean if you do get_TR, then store
> something into global memory and do get_TR again, it will be done twice.
> Also, I wonder why you don't inline it.
>
ben?
I think get_current should be inline, const. get_TR() and
smp_processor_id would be inline, pure.
--
Manfred
next prev parent reply other threads:[~2001-11-09 14:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20011108190546.A29741@redhat.com>
2001-11-09 2:11 ` [PATCH] take 2 of the tr-based current Benjamin LaHaise
2001-11-09 9:13 ` Jakub Jelinek
2001-11-09 14:54 ` Manfred Spraul [this message]
2001-11-09 15:03 ` David S. Miller
2001-11-09 15:33 ` Manfred Spraul
2001-11-09 16:01 ` Richard B. Johnson
2001-11-11 0:01 ` Anton Blanchard
2001-11-11 1:01 ` Benjamin LaHaise
2001-11-11 2:27 ` Anton Blanchard
2001-11-11 9:59 ` Manfred Spraul
2001-11-11 12:36 ` Anton Blanchard
2001-11-11 14:02 ` Manfred Spraul
2001-11-12 3:32 ` Benjamin LaHaise
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=3BEBEE0B.BA1FD7EE@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arjanv@redhat.com \
--cc=bcrl@redhat.com \
--cc=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--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