Rearranging kse mailbox

Julian Elischer julian at elischer.org
Fri Jul 18 16:52:55 PDT 2003



On Fri, 18 Jul 2003, Marcel Moolenaar wrote:

> On Fri, Jul 18, 2003 at 06:40:07PM -0400, Daniel Eischen wrote:
> > > Note that the extra level of indirection on ia64 can be avoided if
> > > we put the thread control structure at a negative offset from TP.
> > > The layout would be something like:
> > > 
> > > -...              0            8     16      ...+
> > > [thread structure][DTV pointer][free][static TLS]
> > > 		  ^
> > > 		  TP
> > 
> > Can we make this work so that we are not limited to
> > 8192 (or whatever max user LDTs are) threads on i386?
> 
> The layout may be specific to ia64. I don't think we should try to
> unify too much across platforms.
> 
> As for the LDT limit: We could keep %gs constant and change the LDT
> entry on a thread switch. That way we only use 1 LDT entry...

That's kind of what we do..

each KSE has an LDT
When we switch the thead running on that KSE we switch the pointer 
at the head of the KSE mailbox.

Since this is NOT the pointer used by other things it doesn't have to eb
done atomically. We could even put the TLS at +VE offsett from that
location as it is the TLS pointer and we have no requirement (in kse)
that it also be the pointer to teh Thread mailbox or thread control
block. (in fact it will NOT be the pointer to the thread mailbox
as THAT has to be set atomically with the context load).
We'd probably keep it -ve to be compatible with libthr and libc_r for
which it would be -ve.

> 
> -- 
>  Marcel Moolenaar	  USPA: A-39004		 marcel at xcllnt.net
> 



More information about the freebsd-threads mailing list