This is the mail archive of the
mailing list for the glibc project.
[Bug libc/11787] Program with large TLS segment fails aio_write
- From: "ppluzhnikov at google dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Fri, 30 Mar 2012 16:44:43 +0000
- Subject: [Bug libc/11787] Program with large TLS segment fails aio_write
- Auto-submitted: auto-generated
- References: <firstname.lastname@example.org/bugzilla/>
--- Comment #25 from Paul Pluzhnikov <ppluzhnikov at google dot com> 2012-03-30 16:44:43 UTC ---
(In reply to comment #24)
> I think the real question here isn't the change in the size of the stack but
> the increase in the # of pages and potential wastage.
> If the TLS is small won't we end up burning an entire page for this small
> amount of data? For apps that use small stacks and lots of threads, that extra
> page could turn out to be significant.
Yes, as I said in comment#12, an application that may notice this is one
that uses lots of threads, and is *almost* running out of VM space.
> I'm not sure I really buy the argument that if a thread asks for 16k that they
> get exactly 16k usable.
Let's also make "malloc(16K)" return 16K or less of usable memory ;-)
> There's no perfect solution here. I wonder if we could come up with a good
> heuristic based on the relative sizes of the TLS and thread requested stack.
> If the TLS is sufficiently small relative to the size of the requested stack,
> then just fold the TLS into the requested stack like we've always done.
> Otherwise, add the size of the TLS to the size of the requested stack (rounding
> to a page of course). Harder to document and implement, but seems like it'd
> strike a better balance.
> I don't know where the cutoff should be, 1%, 10%, 50%? Some experimentation may
> guide us.
Given the data Mike Frysinger and I collected (most binaries using <512
bytes of TLS), I say:
if stack_size_requested >= 16 * __static_tls_sze
use current calculation
increment size request by roundup(__static_tls_size, pagesize())
Most applications today request at least 64K stack (most actually default
to *much* more than that), which would allow up to 4K of static TLS.
But if that same application is instrumented for profiling and suddenly
requires 128K of TLS, it would still work.
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.