From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6236 invoked by alias); 30 Mar 2012 16:46:45 -0000 Received: (qmail 6119 invoked by uid 22791); 30 Mar 2012 16:46:42 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Mar 2012 16:46:31 +0000 From: "ppluzhnikov at google dot com" To: glibc-bugs@sources.redhat.com Subject: [Bug libc/11787] Program with large TLS segment fails aio_write Date: Fri, 30 Mar 2012 21:28:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ppluzhnikov at google dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: carlos_odonell at mentor dot com X-Bugzilla-Target-Milestone: 2.16 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2012-03/txt/msg00416.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=11787 --- Comment #25 from Paul Pluzhnikov 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. Great idea! > 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 else 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.