[Bug 200138] [PATCH] Fixed sthread-specific array allocation conflict incurred in libthr by some foreign malloc libraries

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue May 12 12:55:27 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200138

--- Comment #14 from Konstantin Belousov <kib at FreeBSD.org> ---
(In reply to yuri from comment #13)
Around a 2-3KB of data for the thread is not a burden, comparing with the >=1M
userspace thread stack allocated for each thread.  Also, I believe that any
non-trivial threading program does use thread-specific data, not least because
libc uses per-thread keys in nss and locale code.

But I can suggest to either use the standard libc malloc(3), which does not
have the problem, or direct mmap(2) calls.  The later would result in some
overhead due to unused part of the page for specific array, but this could not
be important, since keys are used rarely, according to you previous reply.

I tend to think that the mmap(2) is preferred, but __malloc() use would also be
fine.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-threads mailing list