diff options
author | Bryan Cantrill <bryan@joyent.com> | 2012-06-09 17:31:14 -0700 |
---|---|---|
committer | Bryan Cantrill <bryan@joyent.com> | 2012-06-09 17:31:14 -0700 |
commit | 3fb330b78c0911247d5eee86f7997a64a9a743e5 (patch) | |
tree | e3e5409575251cf8300730d0cdcdb89cf0fc5635 /usr/src/cmd/svc | |
parent | 7386f4319a95797d8397f24d609435b2c0e027a6 (diff) | |
download | illumos-gate-3fb330b78c0911247d5eee86f7997a64a9a743e5.tar.gz |
Reviewed by: Theo Schlossnagle <jesus@omniti.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Eric Schrock <eric.schrock@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Garrett D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src/cmd/svc')
-rw-r--r-- | usr/src/cmd/svc/configd/configd.c | 16 | ||||
-rw-r--r-- | usr/src/cmd/svc/startd/restarter.c | 40 | ||||
-rw-r--r-- | usr/src/cmd/svc/startd/startd.c | 15 |
3 files changed, 62 insertions, 9 deletions
diff --git a/usr/src/cmd/svc/configd/configd.c b/usr/src/cmd/svc/configd/configd.c index 563d097310..cdff0ef574 100644 --- a/usr/src/cmd/svc/configd/configd.c +++ b/usr/src/cmd/svc/configd/configd.c @@ -23,7 +23,9 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2012, Joyent, Inc. All rights reserved. + */ #include <assert.h> #include <door.h> @@ -109,6 +111,18 @@ int max_repository_backups = 4; #define CONFIGD_MAX_FDS 262144 +const char * +_umem_options_init(void) +{ + /* + * Like svc.startd, we set our UMEM_OPTIONS to indicate that we do not + * wish to have per-CPU magazines to reduce our memory footprint. And + * as with svc.startd, if svc.configd is so MT-hot that this becomes a + * scalability problem, there are deeper issues... + */ + return ("nomagazines"); /* UMEM_OPTIONS setting */ +} + /* * Thanks, Mike */ diff --git a/usr/src/cmd/svc/startd/restarter.c b/usr/src/cmd/svc/startd/restarter.c index a088592d14..a55fb489ad 100644 --- a/usr/src/cmd/svc/startd/restarter.c +++ b/usr/src/cmd/svc/startd/restarter.c @@ -373,9 +373,11 @@ rep_retry: if (inst->ri_logstem != NULL) startd_free(inst->ri_logstem, PATH_MAX); if (inst->ri_common_name != NULL) - startd_free(inst->ri_common_name, max_scf_value_size); + startd_free(inst->ri_common_name, + strlen(inst->ri_common_name) + 1); if (inst->ri_C_common_name != NULL) - startd_free(inst->ri_C_common_name, max_scf_value_size); + startd_free(inst->ri_C_common_name, + strlen(inst->ri_C_common_name) + 1); snap = NULL; inst->ri_logstem = NULL; inst->ri_common_name = NULL; @@ -529,8 +531,25 @@ rep_retry: abort(); } - switch (libscf_get_template_values(scf_inst, snap, - &inst->ri_common_name, &inst->ri_C_common_name)) { + r = libscf_get_template_values(scf_inst, snap, + &inst->ri_common_name, &inst->ri_C_common_name); + + /* + * Copy our names to smaller buffers to reduce our memory footprint. + */ + if (inst->ri_common_name != NULL) { + char *tmp = safe_strdup(inst->ri_common_name); + startd_free(inst->ri_common_name, max_scf_value_size); + inst->ri_common_name = tmp; + } + + if (inst->ri_C_common_name != NULL) { + char *tmp = safe_strdup(inst->ri_C_common_name); + startd_free(inst->ri_C_common_name, max_scf_value_size); + inst->ri_C_common_name = tmp; + } + + switch (r) { case 0: break; @@ -678,9 +697,11 @@ deleted: if (inst->ri_logstem != NULL) startd_free(inst->ri_logstem, PATH_MAX); if (inst->ri_common_name != NULL) - startd_free(inst->ri_common_name, max_scf_value_size); + startd_free(inst->ri_common_name, + strlen(inst->ri_common_name) + 1); if (inst->ri_C_common_name != NULL) - startd_free(inst->ri_C_common_name, max_scf_value_size); + startd_free(inst->ri_C_common_name, + strlen(inst->ri_C_common_name) + 1); startd_free(inst->ri_utmpx_prefix, max_scf_value_size); startd_free(inst, sizeof (restarter_inst_t)); return (ENOENT); @@ -740,9 +761,11 @@ restarter_delete_inst(restarter_inst_t *ri) startd_free((void *)ri->ri_i.i_fmri, strlen(ri->ri_i.i_fmri) + 1); startd_free(ri->ri_logstem, PATH_MAX); if (ri->ri_common_name != NULL) - startd_free(ri->ri_common_name, max_scf_value_size); + startd_free(ri->ri_common_name, + strlen(ri->ri_common_name) + 1); if (ri->ri_C_common_name != NULL) - startd_free(ri->ri_C_common_name, max_scf_value_size); + startd_free(ri->ri_C_common_name, + strlen(ri->ri_C_common_name) + 1); startd_free(ri->ri_utmpx_prefix, max_scf_value_size); (void) pthread_mutex_destroy(&ri->ri_lock); (void) pthread_mutex_destroy(&ri->ri_queue_lock); @@ -1841,6 +1864,7 @@ cont: rip->ri_queue_thread = 0; MUTEX_UNLOCK(&rip->ri_queue_lock); + out: (void) scf_handle_unbind(h); scf_handle_destroy(h); diff --git a/usr/src/cmd/svc/startd/startd.c b/usr/src/cmd/svc/startd/startd.c index f0c57d37eb..14180c5f54 100644 --- a/usr/src/cmd/svc/startd/startd.c +++ b/usr/src/cmd/svc/startd/startd.c @@ -21,6 +21,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ /* @@ -143,6 +144,7 @@ static uint8_t prop_reconfig = 0; pthread_mutexattr_t mutex_attrs; +#ifdef DEBUG const char * _umem_debug_init(void) { @@ -154,6 +156,19 @@ _umem_logging_init(void) { return ("fail,contents"); /* UMEM_LOGGING setting */ } +#endif + +const char * +_umem_options_init(void) +{ + /* + * To reduce our memory footprint, we set our UMEM_OPTIONS to indicate + * that we do not wish to have per-CPU magazines -- if svc.startd is so + * hot on CPU such that this becomes a scalability problem, there are + * likely deeper things amiss... + */ + return ("nomagazines"); /* UMEM_OPTIONS setting */ +} /* * startd_alloc_retry() |