lkml.org 
[lkml]   [2000]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: how does kernel get the "current" task struct?
Date
Followup to:  <14491.15467.98979.699171@dukat.scot.redhat.com>
By author: "Stephen C. Tweedie" <sct@redhat.com>
In newsgroup: linux.dev.kernel
>
> Hi,
>
> On Wed, 02 Feb 2000 18:12:12 -0800, Jun Sun <jsun@mvista.com> said:
>
> > I suppose if you have a global pointer "current", you don't even need
> > to do "andl" instruction. (But you will need to update "current"
> > whenever a context switch happens, and you'll probably have a
> > "current" array in the CMP version.)
>
> That's the whole problem: on SMP, with a current table, you'd have to
> lookup the number of the current CPU every time you wanted to access
> "current". Doing the stack arithmetic trick is _much_ faster than using
> the cpuid instruction.
>

The CPUID instruction doesn't give you the current CPU number.

However, on a machine with oodles of registers, say IA64, you may want
to give your "current" pointer a register instead of using the stack
pointer.

-hpa
--
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

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