diff options
author | John Sonnenschein <johns@joyent.com> | 2012-01-26 22:45:08 +0000 |
---|---|---|
committer | John Sonnenschein <johns@joyent.com> | 2012-01-26 22:45:08 +0000 |
commit | 92fb61a58dea0e097df79e73d3cda1bef52c4339 (patch) | |
tree | 8a9727b7a3600c29b261de4580520de19ec57e56 /usr/src/lib | |
parent | d6f90348d6442b80b8e77a4aaf217cbf86c54bdb (diff) | |
parent | 6a5fc1386817167c00f9ee99bebd9ce35d434593 (diff) | |
download | illumos-joyent-gcc4.tar.gz |
Merge branch 'gcc4' of git.joyent.com:illumos-joyent into gcc4gcc4
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/brand/joyent/zone/statechange.ksh | 3 | ||||
-rwxr-xr-x | usr/src/lib/brand/kvm/zone/kinstall.ksh | 8 | ||||
-rwxr-xr-x | usr/src/lib/brand/kvm/zone/statechange.ksh | 3 | ||||
-rw-r--r-- | usr/src/lib/libumem/common/envvar.c | 38 | ||||
-rw-r--r-- | usr/src/lib/libumem/common/umem.c | 32 | ||||
-rw-r--r-- | usr/src/lib/libumem/common/umem_impl.h | 5 | ||||
-rw-r--r-- | usr/src/lib/libumem/common/vmem.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libumem/common/vmem_base.c | 4 | ||||
-rw-r--r-- | usr/src/lib/libumem/common/vmem_base.h | 5 |
9 files changed, 84 insertions, 16 deletions
diff --git a/usr/src/lib/brand/joyent/zone/statechange.ksh b/usr/src/lib/brand/joyent/zone/statechange.ksh index 70be7819b4..97b041528a 100644 --- a/usr/src/lib/brand/joyent/zone/statechange.ksh +++ b/usr/src/lib/brand/joyent/zone/statechange.ksh @@ -248,7 +248,6 @@ setup_net() fi if [[ $allow_ip_spoof != "1" ]]; then spoof_opts="${spoof_opts}${comma}ip-nospoof" - ip_spoof_enabled="true" comma="," fi if [[ $allow_restricted_traffic != "1" ]]; then @@ -288,7 +287,7 @@ setup_net() fi fi - if [[ -n "${zone_ip}" ]] && [[ -n "${ip_spoof_enabled}" ]] && \ + if [[ -n "${zone_ip}" ]] && [[ $allow_ip_spoof != "1" ]] && \ [[ "${zone_ip}" != "dhcp" ]]; then dladm set-linkprop -t -z $ZONENAME \ -p "allowed-ips=${zone_ip}" ${nic} diff --git a/usr/src/lib/brand/kvm/zone/kinstall.ksh b/usr/src/lib/brand/kvm/zone/kinstall.ksh index abd60a17b7..43b0c953d1 100755 --- a/usr/src/lib/brand/kvm/zone/kinstall.ksh +++ b/usr/src/lib/brand/kvm/zone/kinstall.ksh @@ -66,6 +66,14 @@ PDS_NAME=`mount | nawk -v p=$dname '{if ($1 == p) print $3}'` [ -z "$PDS_NAME" ] && \ print -u2 "Brand error: missing parent ZFS dataset for $dname" +# it's possible to specify a zone root here if you specified the +# '-x nodataset' when installing the zone. +if [[ -n ${TMPLZONE} ]]; then + zfs snapshot $PDS_NAME/${TMPLZONE}@${bname} + zfs clone -o quota=${ZQUOTA}g $PDS_NAME/${TMPLZONE}@${bname} \ + $PDS_NAME/$bname +fi + if [ ! -d ${ZONEPATH}/config ]; then mkdir -p ${ZONEPATH}/config chmod 755 ${ZONEPATH}/config diff --git a/usr/src/lib/brand/kvm/zone/statechange.ksh b/usr/src/lib/brand/kvm/zone/statechange.ksh index 22f647775a..efb10be50e 100755 --- a/usr/src/lib/brand/kvm/zone/statechange.ksh +++ b/usr/src/lib/brand/kvm/zone/statechange.ksh @@ -221,7 +221,6 @@ setup_net() fi if [[ $allow_ip_spoof != "1" ]]; then spoof_opts="${spoof_opts}${comma}ip-nospoof" - ip_spoof_enabled="true" comma="," fi if [[ $allow_restricted_traffic != "1" ]]; then @@ -244,7 +243,7 @@ setup_net() fi fi - if [[ -n "${zone_ip}" ]] && [[ -n "${ip_spoof_enabled}" ]] && \ + if [[ -n "${zone_ip}" ]] && [[ $allow_ip_spoof != "1" ]] && \ [[ "${zone_ip}" != "dhcp" ]]; then dladm set-linkprop -t -z $ZONENAME \ -p "allowed-ips=${zone_ip}" ${nic} diff --git a/usr/src/lib/libumem/common/envvar.c b/usr/src/lib/libumem/common/envvar.c index 949d33ce16..fc3d490a01 100644 --- a/usr/src/lib/libumem/common/envvar.c +++ b/usr/src/lib/libumem/common/envvar.c @@ -22,10 +22,9 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2012 Joyent, Inc. All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <ctype.h> #include <errno.h> #include <limits.h> @@ -84,6 +83,7 @@ typedef struct umem_env_item { #ifndef UMEM_STANDALONE static arg_process_t umem_backend_process; +static arg_process_t umem_allocator_process; #endif static arg_process_t umem_log_process; @@ -100,6 +100,11 @@ static umem_env_item_t umem_options_items[] = { NULL, 0, NULL, NULL, &umem_backend_process }, + { "allocator", "Evolving", ITEM_SPECIAL, + "=best, =first, =next, or =instant", + NULL, 0, NULL, NULL, + &umem_allocator_process + }, #endif { "concurrency", "Private", ITEM_UINT, @@ -473,6 +478,35 @@ fail: CURRENT, name, name, name); return (ARG_BAD); } + + +static int +umem_allocator_process(const umem_env_item_t *item, const char *item_arg) +{ + const char *name = item->item_name; + + if (item_arg == NULL) + goto fail; + + if (strcmp(item_arg, "best") == 0) + vmem_allocator = VM_BESTFIT; + else if (strcmp(item_arg, "next") == 0) + vmem_allocator = VM_NEXTFIT; + else if (strcmp(item_arg, "first") == 0) + vmem_allocator = VM_FIRSTFIT; + else if (strcmp(item_arg, "instant") == 0) + vmem_allocator = 0; + else + goto fail; + + return (ARG_SUCCESS); + +fail: + log_message("%s: %s: must be %s=best, %s=next or %s=first\n", + CURRENT, name, name, name, name); + return (ARG_BAD); + +} #endif static int diff --git a/usr/src/lib/libumem/common/umem.c b/usr/src/lib/libumem/common/umem.c index a3eb0b8e6c..9ee030dd47 100644 --- a/usr/src/lib/libumem/common/umem.c +++ b/usr/src/lib/libumem/common/umem.c @@ -21,11 +21,10 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2012 Joyent, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * based on usr/src/uts/common/os/kmem.c r1.64 from 2001/12/18 * @@ -355,6 +354,17 @@ * umem_log_header_t's: * lh_cpu[*].clh_lock * lh_lock + * + * 7. Changing UMEM_MAXBUF + * ----------------------- + * + * When changing UMEM_MAXBUF extra care has to be taken. It is not sufficient to + * simply increase this number. First, one must update the umem_alloc_table to + * have the appropriate number of entires based upon the new size. If this is + * not done, this will lead to libumem blowing an assertion. + * + * The second place to update, which is not required, is the umem_alloc_sizes. + * These determine the default cache sizes that we're going to support. */ #include <umem_impl.h> @@ -420,7 +430,9 @@ static int umem_alloc_sizes[] = { P2ALIGN(8192 / 2, 64), 4544, P2ALIGN(8192 / 1, 64), 9216, 4096 * 3, - UMEM_MAXBUF, /* = 8192 * 2 */ + 8192 * 2, /* = 8192 * 2 */ + 24576, 32768, 40960, 49152, 57344, 65536, 73728, 81920, + 90112, 98304, 106496, 114688, 122880, UMEM_MAXBUF, /* 128k */ /* 24 slots for user expansion */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -592,6 +604,20 @@ umem_cache_t umem_null_cache = { static umem_cache_t *umem_alloc_table[UMEM_MAXBUF >> UMEM_ALIGN_SHIFT] = { ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, + ALLOC_TABLE_1024, ALLOC_TABLE_1024 }; diff --git a/usr/src/lib/libumem/common/umem_impl.h b/usr/src/lib/libumem/common/umem_impl.h index c6481d9751..84313c32ed 100644 --- a/usr/src/lib/libumem/common/umem_impl.h +++ b/usr/src/lib/libumem/common/umem_impl.h @@ -21,14 +21,13 @@ */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2012 Joyent, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _UMEM_IMPL_H #define _UMEM_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <umem.h> #include <sys/sysmacros.h> @@ -353,7 +352,7 @@ typedef struct umem_cpu { uint32_t cpu_number; } umem_cpu_t; -#define UMEM_MAXBUF 16384 +#define UMEM_MAXBUF 131072 #define UMEM_ALIGN 8 /* min guaranteed alignment */ #define UMEM_ALIGN_SHIFT 3 /* log2(UMEM_ALIGN) */ diff --git a/usr/src/lib/libumem/common/vmem.c b/usr/src/lib/libumem/common/vmem.c index 040517a78f..c868e42977 100644 --- a/usr/src/lib/libumem/common/vmem.c +++ b/usr/src/lib/libumem/common/vmem.c @@ -22,6 +22,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2012 Joyent, Inc. All rights reserved. */ /* @@ -1069,6 +1070,7 @@ vmem_alloc(vmem_t *vmp, size_t size, int vmflag) int hb; int flist = 0; uint32_t mtbf; + vmflag |= vmem_allocator; if (size - 1 < vmp->vm_qcache_max) { ASSERT(vmflag & VM_NOSLEEP); diff --git a/usr/src/lib/libumem/common/vmem_base.c b/usr/src/lib/libumem/common/vmem_base.c index 6b1c07e1ba..dcd83ddf31 100644 --- a/usr/src/lib/libumem/common/vmem_base.c +++ b/usr/src/lib/libumem/common/vmem_base.c @@ -22,14 +22,14 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2012 Joyent, Inc. All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "vmem_base.h" #include "umem_base.h" uint_t vmem_backend = 0; +uint_t vmem_allocator = VM_BESTFIT; vmem_t * vmem_heap_arena(vmem_alloc_t **allocp, vmem_free_t **freep) diff --git a/usr/src/lib/libumem/common/vmem_base.h b/usr/src/lib/libumem/common/vmem_base.h index 46ed397343..a585520e0b 100644 --- a/usr/src/lib/libumem/common/vmem_base.h +++ b/usr/src/lib/libumem/common/vmem_base.h @@ -21,13 +21,12 @@ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2012 Joyent, Inc. All rights reserved. */ #ifndef _VMEM_BASE_H #define _VMEM_BASE_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/vmem.h> #include <umem.h> @@ -66,6 +65,8 @@ extern uint_t vmem_backend; #define VMEM_BACKEND_MMAP 0x0000002 #define VMEM_BACKEND_STAND 0x0000003 +extern uint_t vmem_allocator; + extern vmem_t *vmem_heap; extern vmem_alloc_t *vmem_heap_alloc; extern vmem_free_t *vmem_heap_free; |