[lkml]   [2002]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: kernel: ldt allocation failed
On Wed, Feb 06, 2002 at 02:05:52PM -0800, H. Peter Anvin wrote:
> >>b) Have the kernel provide another GDT value which can be used by the
> >> single-threaded apps.
> >>
> >
> > Like above, a fixed address for mmap would have to be chosen, but the
> > advantage would be that the TLS ABI would need no changing.
> > Simply kernel would add 0x33 to GDT as 4KB -> 0xc0000000 user data segment
> > and apps could put that value into %gs if not using threads.
> >
> > But I think there is c) and d).
> > c) is just minor modification of current ldt handling in kernel, which would
> > mean a single entry LDT (residing in task_struct) could be used instead
> > of vmalloced one - this has the disadvantage of lldt on almost every
> > context switch
> > d) default to a single-entry per-cpu LDT, which only non-linux personality
> > apps and apps needing more than 1 LDT entry (threaded apps, wine/dosemu/...)
> > would not use. Non-linux apps would use current default_ldt and those
> > needing more than one LDT would use the current vmalloced mm private area.
> > If a task would be using this per-cpu LDT (common case), context switch
> > would do lldt only if previous task was not using the per-cpu LDT
> > (unlikely) and just store task_struct->thread.ldt_word_0 and ldt_word_1
> > into the per-cpu LDT (dunno how expensive is that, but IMHO it should be
> > cheaper than full load_LDT).
> >
> Actually d) is probably better done by allowing CPUs to put *one* entry in
> the GDT instead of requesting an LDT. Since the LDT takes up a GDT entry
> anyway, this should be simple enough.

On UP sure, on SMP you'd need to allocate as many GDT entries as there are
CPUs and special case this in __switch_to too (something like
loadsegment(fs, next->fs);
if ((next->gs & 7) == 3 && next->gs >= 0x30 && next->gs < 0x30 + NR_CPUS * 8)
next->gs = smp_processor_id() * 8 + 0x33;
loadsegment(gs, next->gs);
) which is kind of ugly (and userland must not save/restore %gs itself then).
Unlike d) with LDT, where unmodified glibc could work with older kernels
too, thus would mean strict kernel minimum version requirement (with LDT d)
it would be just an optimization).

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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