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/compat | |
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/compat')
-rw-r--r-- | sys/compat/opensolaris/kern/opensolaris_kmem.c | 29 | ||||
-rw-r--r-- | sys/compat/opensolaris/sys/kmem.h | 5 |
2 files changed, 26 insertions, 8 deletions
diff --git a/sys/compat/opensolaris/kern/opensolaris_kmem.c b/sys/compat/opensolaris/kern/opensolaris_kmem.c index 2d6f3e5..a73349f 100644 --- a/sys/compat/opensolaris/kern/opensolaris_kmem.c +++ b/sys/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) { diff --git a/sys/compat/opensolaris/sys/kmem.h b/sys/compat/opensolaris/sys/kmem.h index 288ab7a..89dfac9 100644 --- a/sys/compat/opensolaris/sys/kmem.h +++ b/sys/compat/opensolaris/sys/kmem.h @@ -32,6 +32,7 @@ #include <sys/param.h> #include <sys/proc.h> #include <sys/malloc.h> + #include <vm/uma.h> #include <vm/vm.h> #include <vm/vm_extern.h> @@ -55,8 +56,9 @@ typedef struct kmem_cache { } kmem_cache_t; void *zfs_kmem_alloc(size_t size, int kmflags); -void *kmem_zalloc(size_t size, int kmflags); void zfs_kmem_free(void *buf, size_t size); +u_long kmem_size(void); +u_long kmem_used(void); kmem_cache_t *kmem_cache_create(char *name, size_t bufsize, size_t align, int (*constructor)(void *, void *, int), void (*destructor)(void *, void *), void (*reclaim)(void *) __unused, void *private, vmem_t *vmp, int cflags); @@ -69,6 +71,7 @@ int kmem_debugging(void); void *calloc(size_t n, size_t s); #define kmem_alloc(size, kmflags) zfs_kmem_alloc((size), (kmflags)) +#define kmem_zalloc(size, kmflags) zfs_kmem_alloc((size), (kmflags) | M_ZERO) #define kmem_free(buf, size) zfs_kmem_free((buf), (size)) #endif /* _OPENSOLARIS_SYS_KMEM_H_ */ |