diff options
author | alfred <alfred@FreeBSD.org> | 2012-11-10 02:08:40 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2012-11-10 02:08:40 +0000 |
commit | 7beb738c8a72cc197d3e898784afe3fba28f1834 (patch) | |
tree | 2d08cbee7278cd7eea9a43b81a23320e35210c05 | |
parent | 8e1fdec2c76a948b16ebf8e4abe2cb73a60d3477 (diff) | |
download | FreeBSD-src-7beb738c8a72cc197d3e898784afe3fba28f1834.zip FreeBSD-src-7beb738c8a72cc197d3e898784afe3fba28f1834.tar.gz |
Allow maxusers to scale on machines with large address space.
Some hooks are added to clamp down maxusers and nmbclusters for
small address space systems.
VM_MAX_AUTOTUNE_MAXUSERS - the max maxusers that will be autotuned based on
physical memory.
VM_MAX_AUTOTUNE_NMBCLUSTERS - max nmbclusters based on physical memory.
These are set to the old values on i386 to preserve the clamping that was
being done to all arches.
Another macro VM_AUTOTUNE_NMBCLUSTERS is provided to allow an override
for the calculation on a MD basis. Currently no arch defines this.
Reviewed by: peter
MFC after: 2 weeks
-rw-r--r-- | sys/i386/include/vmparam.h | 9 | ||||
-rw-r--r-- | sys/kern/kern_mbuf.c | 11 | ||||
-rw-r--r-- | sys/kern/subr_param.c | 22 |
3 files changed, 30 insertions, 12 deletions
diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h index ce6672d..9cfd692 100644 --- a/sys/i386/include/vmparam.h +++ b/sys/i386/include/vmparam.h @@ -202,4 +202,13 @@ #define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ +#ifndef VM_MAX_AUTOTUNE_MAXUSERS +#define VM_MAX_AUTOTUNE_MAXUSERS 384 +#endif + +#ifndef VM_MAX_AUTOTUNE_NMBCLUSTERS +/* old maxusers max value. */ +#define VM_MAX_AUTOTUNE_NMBCLUSTERS (1024 + VM_MAX_AUTOTUNE_MAXUSERS * 64) +#endif + #endif /* _MACHINE_VMPARAM_H_ */ diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index de2998b..f8fd0d7 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -113,8 +113,17 @@ tunable_mbinit(void *dummy) /* This has to be done before VM init. */ TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters); - if (nmbclusters == 0) + if (nmbclusters == 0) { +#ifdef VM_AUTOTUNE_NMBCLUSTERS + nmbclusters = VM_AUTOTUNE_NMBCLUSTERS; +#else nmbclusters = 1024 + maxusers * 64; +#endif +#ifdef VM_MAX_AUTOTUNE_NMBCLUSTERS + if (nmbclusters > VM_MAX_AUTOTUNE_NMBCLUSTERS) + nmbclusters = VM_MAX_AUTOTUNE_NMBCLUSTERS; +#endif + } TUNABLE_INT_FETCH("kern.ipc.nmbjumbop", &nmbjumbop); if (nmbjumbop == 0) diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index 5c9af32..b953e78 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -278,17 +278,17 @@ init_param2(long physpages) maxusers = physpages / (2 * 1024 * 1024 / PAGE_SIZE); if (maxusers < 32) maxusers = 32; - /* - * Clips maxusers to 384 on machines with <= 4GB RAM or 32bit. - * Scales it down 6x for large memory machines. - */ - if (maxusers > 384) { - if (sizeof(void *) <= 4) - maxusers = 384; - else - maxusers = 384 + ((maxusers - 384) / 6); - } - } +#ifdef VM_MAX_AUTOTUNE_MAXUSERS + if (maxusers > VM_MAX_AUTOTUNE_MAXUSERS) + maxusers = VM_MAX_AUTOTUNE_MAXUSERS; +#endif + /* + * Scales down the function in which maxusers grows once + * we hit 384. + */ + if (maxusers > 384) + maxusers = 384 + ((maxusers - 384) / 8); + } /* * The following can be overridden after boot via sysctl. Note: |