Date: Thu, 7 Oct 2010 18:16:14 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r213528 - head/sys/cddl/compat/opensolaris/kern Message-ID: <201010071816.o97IGE3g049414@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Thu Oct 7 18:16:14 2010 New Revision: 213528 URL: http://svn.freebsd.org/changeset/base/213528 Log: opensolaris_kmem kmem_size(): report lesser of vm_kmem_size and available physical memory This is needed to correctly autotune ZFS ARC size when vm_kmem_size is set to value larger than available physical memory. MFC after: 2 weeks Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Thu Oct 7 18:11:33 2010 (r213527) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Thu Oct 7 18:16:14 2010 (r213528) @@ -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?201010071816.o97IGE3g049414>