From owner-svn-src-all@FreeBSD.ORG Fri Oct 22 08:57:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46335106564A; Fri, 22 Oct 2010 08:57:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34AD08FC21; Fri, 22 Oct 2010 08:57:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9M8vQHq020927; Fri, 22 Oct 2010 08:57:26 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9M8vQv4020925; Fri, 22 Oct 2010 08:57:26 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010220857.o9M8vQv4020925@svn.freebsd.org> From: Andriy Gapon Date: Fri, 22 Oct 2010 08:57:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214201 - stable/8/sys/cddl/compat/opensolaris/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 22 Oct 2010 08:57:26 -0000 Author: avg Date: Fri Oct 22 08:57:25 2010 New Revision: 214201 URL: http://svn.freebsd.org/changeset/base/214201 Log: MFC r213528: opensolaris_kmem kmem_size(): report lesser of vm_kmem_size and available physical memory Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Fri Oct 22 08:51:49 2010 (r214200) +++ stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Fri Oct 22 08:57:25 2010 (r214201) @@ -112,18 +112,30 @@ zfs_kmem_free(void *buf, size_t size __u free(buf, M_SOLARIS); } +static uint64_t kmem_size_val; + +static void +kmem_size_init(void *unused __unused) +{ + + kmem_size_val = (uint64_t)cnt.v_page_count * PAGE_SIZE; + if (kmem_size_val > vm_kmem_size) + kmem_size_val = vm_kmem_size; +} +SYSINIT(kmem_size_init, SI_SUB_KMEM, SI_ORDER_ANY, kmem_size_init, NULL); + uint64_t kmem_size(void) { - return ((uint64_t)vm_kmem_size); + return (kmem_size_val); } uint64_t kmem_used(void) { - return ((uint64_t)kmem_map->size); + return (kmem_map->size); } static int