From b885580b43755ee4ea1e280b85428893d2ba9291 Mon Sep 17 00:00:00 2001 From: Alexander Kolbasov Date: Tue, 22 Dec 2009 21:52:00 -0800 Subject: 6764832 Provide user-level processor groups observability 6831680 cputrack(1) leaves its victim with unneeded cpc context 6901343 cpc context flag updates are not always atomic 6908152 Dormant thread CPC context affects cpu CPC consumers --- usr/src/lib/libcpc/common/libcpc.c | 25 +++++++++++++++++++++++++ usr/src/lib/libcpc/common/libcpc.h | 4 +++- usr/src/lib/libcpc/common/mapfile-vers | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) (limited to 'usr/src/lib/libcpc') diff --git a/usr/src/lib/libcpc/common/libcpc.c b/usr/src/lib/libcpc/common/libcpc.c index 5bdba39fda..9f4f6ac848 100644 --- a/usr/src/lib/libcpc/common/libcpc.c +++ b/usr/src/lib/libcpc/common/libcpc.c @@ -168,6 +168,23 @@ cpc_close(cpc_t *cpc) return (0); } +/* + * Terminate everything that runs in pctx_run + */ +void +cpc_terminate(cpc_t *cpc) +{ + cpc_set_t *csp; + int sigblocked; + + sigblocked = cpc_lock(cpc); + for (csp = cpc->cpc_sets; csp != NULL; csp = csp->cs_next) { + if (csp->cs_pctx != NULL) + pctx_terminate(csp->cs_pctx); + } + cpc_unlock(cpc, sigblocked); +} + cpc_set_t * cpc_set_create(cpc_t *cpc) { @@ -224,6 +241,14 @@ cpc_set_destroy(cpc_t *cpc, cpc_set_t *set) if (csp->cs_state != CS_UNBOUND) (void) cpc_unbind(cpc, csp); + /* + * Detach from the process + */ + if (csp->cs_pctx != NULL) { + pctx_release(csp->cs_pctx); + csp->cs_pctx = NULL; + } + for (req = csp->cs_request; req != NULL; req = next) { next = req->cr_next; diff --git a/usr/src/lib/libcpc/common/libcpc.h b/usr/src/lib/libcpc/common/libcpc.h index 384474a76c..73627345a0 100644 --- a/usr/src/lib/libcpc/common/libcpc.h +++ b/usr/src/lib/libcpc/common/libcpc.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -163,6 +163,8 @@ extern void cpc_walk_attrs(cpc_t *cpc, void *arg, extern int cpc_enable(cpc_t *cpc); extern int cpc_disable(cpc_t *cpc); +extern void cpc_terminate(cpc_t *); + #if defined(__sparc) || defined(__i386) /* diff --git a/usr/src/lib/libcpc/common/mapfile-vers b/usr/src/lib/libcpc/common/mapfile-vers index 91f1689c9f..e577fc7c5e 100644 --- a/usr/src/lib/libcpc/common/mapfile-vers +++ b/usr/src/lib/libcpc/common/mapfile-vers @@ -83,6 +83,7 @@ SUNW_1.2 { SUNWprivate_1.1 { global: SUNWprivate_1.1; + cpc_terminate; local: *; }; -- cgit v1.2.3