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

Manfred Spraul (manfred@colorfullife.com)
Fri, 09 Nov 2001 16:33:04 +0100


"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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/