-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2/1/2011 5:24 PM, Alexander Gordeev wrote:
> В Sat, 29 Jan 2011 16:50:11 -0500
> Rich Felker <[email protected]> пишет:
> 
>  > On Fri, Jan 28, 2011 at 09:31:37AM +0000, Carl Shaw wrote:
>  > > This occurs because the default maximum stack size is usually 8MB (check
>  > > using ulimit -s or -a at a shell prompt).
>  > >
>  > > You have a number of options to change this:
>  > >
>  > [...]
>  > > 2. Allocate your own stack memory, insert into to a thread attribute
>  > > structure using pthread_attr_setstack() and use that when creating the
>  > > thread with pthread_create()
>  >
>  > This is the approach application developers should take, since some
>  > libcs offer ridiculously large stacks (which are reserved/committed on
>  > systems with overcommit protection!) while others offer tiny ones. A
>  > portable program that uses nontrivial stack space needs to ensure it
>  > will be given enough, and a program that doesn't want to waste memory
>  > should ensure that it's not given too much.
>  >
>  > > 3. Patch the C library to use a more appropriate default rather than
>  > > calling getrlimit(RLIMIT_STACK)!
>  >
>  > This sounds like a patch that belongs in uclibc. 32k would be a
>  > reasonable default.
> 
> I was completely satisfied with the following patch:
> http://nbd.name/190-nptl_use_arch_default_stack_limit.patch
> 
> Maybe it can be accepted in the main tree?
> 
> Link to the discussion on openwrt-devel:
> https://lists.openwrt.org/pipermail/openwrt-devel/2011-January/009439.html
> 
> --
> Alexander
> 

The patch

- --- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -401,6 +401,10 @@ __pthread_initialize_minimal_internal (v
        Use the minimal size acceptable.  */
     limit.rlim_cur = PTHREAD_STACK_MIN;

+  /* Do not exceed architecture specific default */
+  if (limit.rlim_cur > ARCH_STACK_DEFAULT_SIZE)
+    limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
+
   /* Make sure it meets the minimum size that allocate_stack
      (allocatestack.c) will demand, which depends on the page size.  */
   const uintptr_t pagesz = sysconf (_SC_PAGESIZE);

At least the check should be guarded by #ifdef ARCH_STACK_DEFAULT_SIZE.

Anyway, where are you thinking to define this one ?
A new config option ?
A define into uClibc_arch_feature.h (but it is not arch dependant, while
an specific target configuration)

else ?

Cheers,
Carmelo


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1IOKAACgkQoRq/3BrK1s93AgCgnWMbvsJ5XjZdVlWuAaZPu7FN
S7AAoKjh2/HmalTpRHF18dY+QTN7adbq
=ba0i
-----END PGP SIGNATURE-----
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to