From owner-svn-src-all@FreeBSD.ORG Fri Nov 15 16:05:56 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9BDF8E7; Fri, 15 Nov 2013 16:05:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 70CBA2356; Fri, 15 Nov 2013 16:05:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAFG5uoA075801; Fri, 15 Nov 2013 16:05:56 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAFG5uUl075789; Fri, 15 Nov 2013 16:05:56 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201311151605.rAFG5uUl075789@svn.freebsd.org> From: "Justin T. Gibbs" Date: Fri, 15 Nov 2013 16:05:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258176 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2013 16:05:56 -0000 Author: gibbs Date: Fri Nov 15 16:05:55 2013 New Revision: 258176 URL: http://svnweb.freebsd.org/changeset/base/258176 Log: Fix accounting for hw.realmem on the i386 and amd64 platforms. sys/i386/i386/machdep.c: sys/amd64/amd64/machdep.c: The value reported by FreeBSD as "real memory" when booting doesn't match what is later reported by sysctl as hw.realmem. This is due to the fact that the value printed during the boot process is fetched from smbios data (when possible), and accounts for holes in physical memory. On the other hand, the value of hw.realmem is unconditionally set to be one larger than the highest page of the physical address space. Fix this by setting hw.realmem to the same value printed during boot, this makes hw.realmem honour it's name and account properly for physical memory present in the system. Submitted by: Roger Pau Monné Reviewed by: gibbs Modified: head/sys/amd64/amd64/machdep.c head/sys/i386/i386/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Fri Nov 15 16:03:32 2013 (r258175) +++ head/sys/amd64/amd64/machdep.c Fri Nov 15 16:05:55 2013 (r258176) @@ -256,7 +256,6 @@ cpu_startup(dummy) #ifdef PERFMON perfmon_init(); #endif - realmem = Maxmem; /* * Display physical memory if SMBIOS reports reasonable amount. @@ -270,6 +269,7 @@ cpu_startup(dummy) if (memsize < ptoa((uintmax_t)cnt.v_free_count)) memsize = ptoa((uintmax_t)Maxmem); printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20); + realmem = atop(memsize); /* * Display any holes after the first chunk of extended memory. Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Fri Nov 15 16:03:32 2013 (r258175) +++ head/sys/i386/i386/machdep.c Fri Nov 15 16:05:55 2013 (r258176) @@ -294,7 +294,6 @@ cpu_startup(dummy) #ifdef PERFMON perfmon_init(); #endif - realmem = Maxmem; /* * Display physical memory if SMBIOS reports reasonable amount. @@ -308,6 +307,7 @@ cpu_startup(dummy) if (memsize < ptoa((uintmax_t)cnt.v_free_count)) memsize = ptoa((uintmax_t)Maxmem); printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20); + realmem = atop(memsize); /* * Display any holes after the first chunk of extended memory.