summaryrefslogtreecommitdiff
path: root/usr/src/lib/libcpc
diff options
context:
space:
mode:
authorAlexander Kolbasov <Alexander.Kolbasov@Sun.COM>2009-12-22 21:52:00 -0800
committerAlexander Kolbasov <Alexander.Kolbasov@Sun.COM>2009-12-22 21:52:00 -0800
commitb885580b43755ee4ea1e280b85428893d2ba9291 (patch)
treef7f7848d3eef390282bab6fc859d7a5275053ecf /usr/src/lib/libcpc
parente7437094ebbbd4d60375f3927c017ff00cbab1de (diff)
downloadillumos-gate-b885580b43755ee4ea1e280b85428893d2ba9291.tar.gz
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
Diffstat (limited to 'usr/src/lib/libcpc')
-rw-r--r--usr/src/lib/libcpc/common/libcpc.c25
-rw-r--r--usr/src/lib/libcpc/common/libcpc.h4
-rw-r--r--usr/src/lib/libcpc/common/mapfile-vers1
3 files changed, 29 insertions, 1 deletions
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:
*;
};