Module: xenomai-head
Branch: master
Commit: a1187c3d283cdee9a0e1052a06234860009769ff
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=a1187c3d283cdee9a0e1052a06234860009769ff

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Jul 16 15:34:44 2009 +0200

native: force no more than PTHREAD_STACK_MIN bytes for stack size

The glibc tends to increase the minimum stack size for POSIX threads,
up to a preposterous 128k value these days, which leads to overkill
memory commits when a multi-threaded process mlocks its data segment.

Make rt_task_create() use PTHREAD_STACK_MIN, instead of two/four times
this value when the user did not specify a valid stack size. Normally,
PTHREAD_STACK_MIN is at least 16k, even for oldish linuxthreads
implementations.

---

 src/skins/native/task.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/skins/native/task.c b/src/skins/native/task.c
index 013a6b6..6df1e88 100644
--- a/src/skins/native/task.c
+++ b/src/skins/native/task.c
@@ -146,10 +146,8 @@ int rt_task_create(RT_TASK *task,
 
        pthread_attr_init(&thattr);
 
-       if (stksize == 0)
-               stksize = PTHREAD_STACK_MIN * 4;
-       else if (stksize < PTHREAD_STACK_MIN * 2)
-               stksize = PTHREAD_STACK_MIN * 2;
+       if (stksize < PTHREAD_STACK_MIN)
+               stksize = PTHREAD_STACK_MIN;
 
        pthread_attr_setinheritsched(&thattr, PTHREAD_EXPLICIT_SCHED);
        memset(&param, 0, sizeof(param));


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to