Re: [PATCH] task_struct colouring ...

H. Peter Anvin (hpa@zytor.com)
1 Dec 2001 14:04:43 -0800


Followup to: <000901c17a51$62526070$010411ac@local>
By author: "Manfred Spraul" <manfred@colorfullife.com>
In newsgroup: linux.dev.kernel
>
> There are obviously lots of alternatives how to look up the task structure address:
> * bottom of stack allocation (your patch)
> * %cr2 (broken, only works for OS' that never cause page faults such as Netware)
> * gs: (segment register, x86-64 uses that. But i386 doesn't have the swapgs instruction)
> * str (Ben's patch)
> * read from local apic memory (real slow!, uncached memory reference)
>

%gs on x86-64 actually points to a per-CPU area; as does the proposed
%tr hack. IMNSHO I think this is a much better idea than having
something that points to "current"; if we do this consistently across
architectures I'm sure there is plenty we can use this per-CPU area
for.

Saving and restoring %gs (or %fs, which is less likely to be used in
userspace, and therefore potentially faster) is probably not
justifiable unless we do at least four accesses to "current" in the
average system call.

-hpa

-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>
-
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/