[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xenstore: set READ_THREAD_STACKSIZE to a sane value



On 11/03/14 17:25, Ian Jackson wrote:
> Ian Campbell writes ("Re: [PATCH] xenstore: set READ_THREAD_STACKSIZE to a 
> sane value"):
>> On Tue, 2014-03-11 at 17:18 +0100, Roger Pau Monné wrote:
>>> Another question to ask would be why FreeBSD sets PTHREAD_STACK_MIN to
>>> 2048 when even a simple malloc call is going to blow that up,
>>
>> It does seem rather aggressive, but I suppose it is "min" not
>> "sensible_min".
> 
> Well, actually, a malloc works, doesn't it ?

No, actually a malloc with PTHREAD_STACK_MIN doesn't work, this sample 
example program fails in the same way:

---
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

#define MALLOC_SIZE 1024

void *
foo(void *arg)
{
        void *bar;

        bar = malloc(MALLOC_SIZE);
        assert(bar != NULL);

        return (NULL);
}

int main(void)
{
        pthread_t thread;
        pthread_attr_t attr;
        int rc, i;

        rc = pthread_attr_init(&attr);
        assert(rc == 0);

        rc = pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
        assert(rc == 0);

        rc = pthread_create(&thread, &attr, foo, NULL);
        assert(0 == rc);

        rc = pthread_join(thread, NULL);
        assert(0 == rc);

        exit(EXIT_SUCCESS);
}


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.