Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Oct 2010 08:57:26 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r214201 - stable/8/sys/cddl/compat/opensolaris/kern
Message-ID:  <201010220857.o9M8vQv4020925@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010220857.o9M8vQv4020925>