diff options
author | pjd <pjd@FreeBSD.org> | 2007-04-10 02:35:57 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2007-04-10 02:35:57 +0000 |
commit | 648f58f532a7d0f21a8b274e2caec17c98a880ff (patch) | |
tree | 2e0afb886e8d0f7afaf6d324c896b1187944512a /sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c | |
parent | 9cb5f5d713f6ab8b5b850ee732b46aa4b9c80d49 (diff) | |
download | FreeBSD-src-648f58f532a7d0f21a8b274e2caec17c98a880ff.zip FreeBSD-src-648f58f532a7d0f21a8b274e2caec17c98a880ff.tar.gz |
Try to stabilize ZFS with regard to memory consumption:
- Allow to shrink ARC down to 16MB (instead of 64MB).
- Set arc_max to 1/2 of kmem_map by default.
- Start freeing things earlier when low memory situation is detected.
- Serialize execution of arc_lowmem().
I decided to setup minimum ZFS memory requirements to 512MB of RAM and 256MB of
kmem_map size. If there is less RAM or kmem_map, a warning will be printed.
World is cruel, be no better. In other words: modern file system requires
modern hardware:)
From ZFS administration guide:
"Currently the minimum amount of memory recommended to install a Solaris
system is 512 Mbytes. However, for good ZFS performance, at least one
Gbyte or more of memory is recommended."
Diffstat (limited to 'sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c')
-rw-r--r-- | sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c b/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c index 2d6f3e5..a73349f 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c @@ -31,12 +31,19 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/systm.h> #include <sys/malloc.h> -#include <vm/uma.h> #include <sys/kmem.h> #include <sys/debug.h> #include <sys/mutex.h> + +#include <vm/vm_page.h> +#include <vm/vm_object.h> +#include <vm/vm_kern.h> +#include <vm/vm_map.h> + +#ifdef KMEM_DEBUG #include <sys/queue.h> #include <sys/stack.h> +#endif #ifdef _KERNEL static MALLOC_DEFINE(M_SOLARIS, "solaris", "Solaris"); @@ -82,12 +89,6 @@ zfs_kmem_alloc(size_t size, int kmflags) return (p); } -void * -kmem_zalloc(size_t size, int kmflags) -{ - return (kmem_alloc(size, kmflags | M_ZERO)); -} - void zfs_kmem_free(void *buf, size_t size __unused) { @@ -107,6 +108,20 @@ zfs_kmem_free(void *buf, size_t size __unused) free(buf, M_SOLARIS); } +u_long +kmem_size(void) +{ + + return ((u_long)vm_kmem_size); +} + +u_long +kmem_used(void) +{ + + return ((u_long)kmem_map->size); +} + static int kmem_std_constructor(void *mem, int size __unused, void *private, int flags) { |