This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: linuxthreads: why limit stack size to STACK_SIZE when not using FLOATING_STACK ?

On Tue, Aug 07, 2001 at 09:02:17PM -0700, Ken Whaley wrote:
> In glibc-2.2.3 and 2.2.4pre2, if you try to build linuxthreads
> on x86 without useldt.h by specifying an older kernel version (so that
> FLOATING_STACK is not defined), __pthread_attr_setstacksize() and
> __pthread_init_max_stacksize enforce a limit of STACK_SIZE (2MB)
> maximum stacksize.
> If the user wants to supply a stack larger than STACK_SIZE
> and getrlimit() will allow the larger size, is there some
> reason not to allow it when not including useldt.h on x86?

Yes. On IA-32 in that case there is no thread register (like %gs with
--enable-kernel=2.4.0+ on i686, %g6 on sparc, %r13 on ia64, etc.),
so the thread descriptor needs to be computed from current %esp value and
that is done by (pthread_descr)(((unsigned long)sp | (STACK_SIZE-1))+1) - 1,
so you really cannot use arbitrary stack sizes.
Use FLOATING_STACKS and be happy, they are there exactly so that you can ask
whatever thread stack size you want (and it can vary among threads).
Without FLOATING_STACKS, even if you choose smaller stacksize than 2MB, it
will occupy 2MB of virtual address space.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]