From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20831 invoked by alias); 8 Oct 2002 01:06:55 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 20804 invoked from network); 8 Oct 2002 01:06:54 -0000 Received: from unknown (HELO gateway.sf.frob.com) (64.163.215.223) by sources.redhat.com with SMTP; 8 Oct 2002 01:06:54 -0000 Received: from magilla.sf.frob.com (magilla.sf.frob.com [198.49.250.228]) by gateway.sf.frob.com (Postfix) with ESMTP id 2D5FC357E; Mon, 7 Oct 2002 18:06:54 -0700 (PDT) Received: (from roland@localhost) by magilla.sf.frob.com (8.11.6/8.11.6) id g9816rJ27102; Mon, 7 Oct 2002 18:06:53 -0700 Date: Mon, 07 Oct 2002 21:43:00 -0000 Message-Id: <200210080106.g9816rJ27102@magilla.sf.frob.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Ulrich Drepper Cc: Jakub Jelinek , Glibc hackers Subject: Re: [PATCH] __libc_alloca_cutoff (aka make mysql and others apps with very low RLIMIT_STACK setting happy) In-Reply-To: Ulrich Drepper's message of Monday, 7 October 2002 16:19:55 -0700 <3DA2169B.2070004@redhat.com> X-Antipastobozoticataclysm: Bariumenemanilow X-SW-Source: 2002-10/txt/msg00036.txt.bz2 > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Jakub Jelinek wrote: > > > --- libc/include/alloca.h.jj 2002-09-30 16:45:04.000000000 +0200 > > +++ libc/include/alloca.h 2002-10-08 00:12:01.000000000 +0200 > > @@ -11,4 +11,16 @@ extern void *__alloca (size_t __size); > > # define __alloca(size) __builtin_alloca (size) > > #endif /* GCC. */ > > > > +extern size_t __libc_alloca_cutoff; > > +libc_hidden_proto (__libc_alloca_cutoff) > > We should have this variable per-thread (use __thread). Tis way a few > worker threads using very small stack do not affect to whole process. Conversely instead of a variable we could have a function that's given the size and returns whether to use alloca or malloc. The libc version can just say to always use alloca, I don't care about supporting tiny RLIMIT_STACK values for single-threaded programs. The libpthread version can look at the thread's stack size vs the allocation, and perhaps even look at the current stack depth. Then we don't have to diddle setrlimit and all the rest, or add the word of TLS data