Re: [PATCH] take 2 of the tr-based current

Manfred Spraul
2001-11-09T15:33:21Z

"David S. Miller" wrote:
>
> From: Manfred Spraul <manfred@colorfullife.com>
> Date: Fri, 09 Nov 2001 15:54:03 +0100
>
> Jakub Jelinek wrote:
> > 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.
>
> As far as what the compiler can see or care about, it is
> const.
>
No. const == never changes.
get_TR changes if a task calls schedule, and return on another cpu.

<<<
+static unsigned get_TR(void) __attribute__ ((pure))
+{
+ unsigned tr;
+ __asm__("str %w0" : "=g" (tr));
+ return tr;
+}
+
+#define smp_processor_id() ( ((get_TR() >> 3) - __FIRST_TSS_ENTRY)
>> 2 )
<<<
smp_processor_id() is definitively not const.

OTHO 'current' is const.
--
Manfred