[lkml]   [2001]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] take 2 of the tr-based current
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.
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.

I think get_current should be inline, const. get_TR() and
smp_processor_id would be inline, pure.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:13    [W:0.113 / U:3.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site