diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-12-22 01:46:09 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-12-22 01:46:09 +0000 |
commit | cff695fb4c59ce0cb7bb1724e3c6eafa5906957d (patch) | |
tree | b8edf58d5b033920c4434fae1f8901d34b3f17b8 | |
parent | 24f818725bb7eeffff055fe5b5a0cd0bdf490bca (diff) |
Jie Zhang writes:
I think the loop was written for MMU case. When there is MMU, mmap ()
is used to allocate the stack. If one segment is already mapped, we
should continue to see if we can use the next one. However, for NOMMU,
malloc () is used. It's waste of CPU cycles to continue to try if it
fails. Here is a new patch, which makes this change only for NOMMU.
-rw-r--r-- | libpthread/linuxthreads.old/manager.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c index 204344aef..7ad5ab525 100644 --- a/libpthread/linuxthreads.old/manager.c +++ b/libpthread/linuxthreads.old/manager.c @@ -498,6 +498,14 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, &new_thread, &new_thread_bottom, &guardaddr, &guardsize) == 0) break; +#ifndef __ARCH_HAS_MMU__ + else + /* When there is MMU, mmap () is used to allocate the stack. If one + * segment is already mapped, we should continue to see if we can + * use the next one. However, when there is no MMU, malloc () is used. + * It's waste of CPU cycles to continue to try if it fails. */ + return EAGAIN; +#endif } __pthread_handles_num++; /* Allocate new thread identifier */ |