From owner-freebsd-current Tue Jul 13 0:32:18 1999 Delivered-To: freebsd-current@freebsd.org Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by hub.freebsd.org (Postfix) with ESMTP id B348614EFF for ; Tue, 13 Jul 1999 00:32:15 -0700 (PDT) (envelope-from alc@cs.rice.edu) Received: (from alc@localhost) by cs.rice.edu (8.9.0/8.9.0) id CAA17885; Tue, 13 Jul 1999 02:30:12 -0500 (CDT) Date: Tue, 13 Jul 1999 02:30:12 -0500 From: Alan Cox To: Dmitrij Tejblum Cc: Jason Evans , current@freebsd.org Subject: Re: Thread stack allocation (was Re: cvs commit: src/lib/libc_r Makefile src/lib/libc_r/uthread pthread_private.h uthread_create.c uthread_gc.c uthread_init.c) Message-ID: <19990713023012.K6401@cs.rice.edu> References: <199907121853.WAA27876@arc.hq.cti.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.5us In-Reply-To: <199907121853.WAA27876@arc.hq.cti.ru>; from Dmitrij Tejblum on Mon, Jul 12, 1999 at 10:53:49PM +0400 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, Jul 12, 1999 at 10:53:49PM +0400, Dmitrij Tejblum wrote: > > I don't see how MAP_ANON is better than MAP_STACK. > It consumes fewer resources. Each time you grow the stack, it adds another vm_map_entry to the vm_map and (eventually) allocates another vm_object. Using MAP_ANON, there is at most one vm_object and one vm_map_entry (until an mprotect chops it up). > ... > > Anyway, what are the advantages of mmap over malloc? Especially if you change > MAP_STACK to MAP_ANON? > None really. But, the real point (as I've explained on the -committers list) is that there's no reason to use MAP_STACK in a FreeBSD-native program. Alan P.S. As an aside, just once, everyone should look at the /proc/"pid"/map of a running cvsup. Each line you see is a vm_map_entry. (What you see is a result of Modula-3's garbage collector.) Roughly speaking, on a page fault, if we're not faulting on the same range of addresses as the last page fault, a linear cost search is performed to find the correct entry. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message