All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Steve Deiters <SteveDeiters@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] POSIX skin default stacksize
Date: Thu, 21 Jan 2010 09:29:30 +0100	[thread overview]
Message-ID: <4B58106A.2010306@domain.hid> (raw)
In-Reply-To: <181804936ABC2349BE503168465576460D7138C6@domain.hid>

Steve Deiters wrote:
> I'm trying to determine the source of a bogus initial stack size after I
> initialize a pthread_attr_t with pthread_attr_init.  I'm using the POSIX
> skin (obviously), but I'm not quite sure if it is getting this parameter
> from Xenomai or libc.
> 
> I'm running on a custom PowerPC board with a version 2.6.24.6 kernel.  I
> get the same result using both Xenomai 2.4.10, and 2.5.0.  I noticed the
> issue after having a small program with a few number of threads that was
> crashing the system with an out of memory exception.
> 
> I have a very basic program ...
> 
> ----------------------main.c--------------------------
> #include <stdio.h>
> #include <pthread.h>
> #include <limits.h>
> 
> int main(int argc, char **argv)
> {
>    size_t s;
>    pthread_attr_t a;
> 
>    pthread_attr_init(&a);
>    pthread_attr_getstacksize(&a, &s);
> 
>    printf("PTHREAD_STACK_MIN is %d\n", PTHREAD_STACK_MIN);
>    printf("Default stack size is %d\n", s);
> 
>    return 0;
> }
> -----------------------------------------------------
> 
> For which the output is
> 
>> PTHREAD_STACK_MIN is 16384
>> Default stack size is 8388608
> 
> As you can see, the stack size after I call pthread_attr_init is a
> whopping 8 MB.
> 
> From what I can tell, it is linking against the correct library.  I can
> see the Xenomai options to the linker, with the -lpthread_rt and all
> that.
> 
> Any idea why this would occur?

We do not wrap calls to pthread_attr_init, pthread_attr_setstacksize.
What you see are glibc default for your platform. If you want a
different size, use pthread_attr_setstacksize. Glibc default are made
for general purpose application running on multi-gigas memory x86 boxes.
For other applications, you end up in endless calls to the heavy-weith
pthread interface, pthread_attr_init, pthread_attr_setstacksize,
pthread_attr_setinheritsched, pthread_attr_setschedpolicy,
pthread_attr_setschedparam, pthread_mutexatttr_init,
pthread_mutexattr_setprotocol, pthread_mutexattr_settype, etc...


> 
> Thanks
> 
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help


-- 
					    Gilles.


      reply	other threads:[~2010-01-21  8:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-20 23:57 [Xenomai-help] POSIX skin default stacksize Steve Deiters
2010-01-21  8:29 ` Gilles Chanteperdrix [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B58106A.2010306@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=SteveDeiters@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.