From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 9 19:25:34 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EAC0F16A41F for ; Fri, 9 Dec 2005 19:25:34 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.10.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0826343D5A for ; Fri, 9 Dec 2005 19:25:33 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (localhost [127.0.0.1]) by eva.fit.vutbr.cz (envelope-from xdivac02@eva.fit.vutbr.cz) (8.13.4/8.13.3) with ESMTP id jB9JPTbt042911 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Fri, 9 Dec 2005 20:25:29 +0100 (CET) Received: (from xdivac02@localhost) by eva.fit.vutbr.cz (8.13.4/8.13.3/Submit) id jB9JPTr9042910 for freebsd-hackers@freebsd.org; Fri, 9 Dec 2005 20:25:29 +0100 (CET) Date: Fri, 9 Dec 2005 20:25:29 +0100 From: Divacky Roman To: freebsd-hackers@freebsd.org Message-ID: <20051209192529.GA40894@stud.fit.vutbr.cz> References: <20051209010616.GA59667@troutmask.apl.washington.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051209010616.GA59667@troutmask.apl.washington.edu> User-Agent: Mutt/1.4.2i X-Scanned-By: MIMEDefang 2.49 on 147.229.10.14 Subject: Re: sysctl, HW_PHYSMEM, and crippled gcc X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2005 19:25:35 -0000 On Thu, Dec 08, 2005 at 05:06:16PM -0800, Steve Kargl wrote: > Anyone have any insight into fixing gcc to make better > use of system memory on systems with more than 4 GB. > It appears that libiberty/physmem.c tries to use sysctl() > to determine the amount of physical memory in a system. > > { /* This works on *bsd and darwin. */ > unsigned int physmem; > size_t len = sizeof physmem; > static int mib[2] = { CTL_HW, HW_PHYSMEM }; > > if (sysctl (mib, ARRAY_SIZE (mib), &physmem, &len, NULL, 0) == 0 > && len == sizeof (physmem)) > return (double) physmem; > } > > This works if you have less than 4GB because of the unsigned > int physmem. I have 12 GB, which of course, when expanded > to the number of bytes doesn't fit into a unsigned int physmem. > > What is the ramification? Well, gcc uses this estimate of > memory to size internal parameters. > > troutmask:sgk[259] gcc -v h.c > Using built-in specs. > Configured with: FreeBSD/amd64 system compiler > Thread model: posix > gcc version 3.4.4 [FreeBSD] 20050518 > GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 > > In particular, ggc-min-heapsize=4096 is ridiculously small for a > system with 12 GB of memory. the code works here (512M of memory)... dont know about the ifdefs its surrounded by.. if you manually rewrite the physmem to some bigger value - does it have any effect on performance of gcc? roman