All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] Efficient Pthread Implementation
@ 2001-03-20  4:43 Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2001-03-20  4:43 UTC (permalink / raw
  To: parisc-linux

Pthreads needs a way to find the address of the thread control structure
for the task which is currently running.  If we use fixed instead of
floating stacks, and don't tell it to use a different stack (unsure
what circumstances will cause this to happen, or the advantages of
configuring pthreads to use floating stacks), then everything is fine,
we can simply take the stack pointer, mask it with the stack size and
get the answer we were looking for.

If we use a different stack, then it scans the various stacks looking
to see which stack contains this stack pointer, unless the architecture
specifies a better way to find it.  x86 uses one of the segment registers,
ia64 uses a register specified in the ABI.  I propose we could use %cr27.
It's readable from userspace, and we could have a 2-insn stub on the
gateway page which sets %cr27 as necessary.  We then have to switch its
value across context switch, which doesn't seem like a big deal to me.

Comments?  Better ideas?

-- 
Revolutions do not require corporate support.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [parisc-linux] Efficient Pthread Implementation
@ 2001-03-20 20:02 Cary Coutant
  0 siblings, 0 replies; 2+ messages in thread
From: Cary Coutant @ 2001-03-20 20:02 UTC (permalink / raw
  To: Matthew Wilcox, parisc-linux

>I propose we could use %cr27.
>It's readable from userspace, and we could have a 2-insn stub on the
>gateway page which sets %cr27 as necessary.  We then have to switch its
>value across context switch, which doesn't seem like a big deal to me.

This is what HP-UX does. We provide a lightweight system call for setting 
it. I believe that we recommend reading it at most once per procedure and 
caching it in a GR, because of the latency reading from a CR.

-cary

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-03-20 20:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-20 20:02 [parisc-linux] Efficient Pthread Implementation Cary Coutant
  -- strict thread matches above, loose matches on Subject: below --
2001-03-20  4:43 Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.