[ovs-dev] [PATCH] [RFC] lib/ovs-thread: set pthread stack size to 128k

Ben Pfaff blp at ovn.org
Tue Feb 2 18:24:14 UTC 2016


On Tue, Feb 02, 2016 at 01:13:16PM +0200, Alexandru Ardelean wrote:
> Would it be an idea to add a ?
> #ifndef OVS_DEFAULT_THREAD_STACK_SIZE
> #define OVS_DEFAULT_THREAD_STACK_SIZE  (2 * 1024 * 1024)
> #endif
> 
> That way for our embedded musl libc case, we could add it to our CFLAGS.

What if we add a *minimum* stack size instead?  If the default is higher
than the minimum, I'd rather not reduce it.  Something like this:

    #define OVS_MIN_THREAD_STACK_SIZE (512 * 1024)
    pthread_attr attr;
    size_t stacksize;

    pthread_attr_init(&attr);
    if (!pthread_attr_getstacksize(&attr, &stacksize)
        && stacksize < OVS_MIN_THREAD_STACK_SIZE) {
        pthread_attr_setstacksize(&attr, OVS_MIN_THREAD_STACK_SIZE);
    }

although we'd probably want to report it if either pthread function
returned an error.



More information about the dev mailing list