summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os/rctl.c
diff options
context:
space:
mode:
authorRobert Harris <Robert.Harris@Sun.COM>2008-10-23 07:21:39 -0700
committerRobert Harris <Robert.Harris@Sun.COM>2008-10-23 07:21:39 -0700
commit0032277fca721fca99bbb3fc27c6814f474eff62 (patch)
tree4dcd6ea1a6d0ec6ca11a255d4fc6338a89def70c /usr/src/uts/common/os/rctl.c
parentc7d6cfd6e2ae5d7536ef67f65110733890f370a4 (diff)
downloadillumos-joyent-0032277fca721fca99bbb3fc27c6814f474eff62.tar.gz
6729368 Panic from three-way cycle involving zonehash_lock, pidlock and p_lock
Diffstat (limited to 'usr/src/uts/common/os/rctl.c')
-rw-r--r--usr/src/uts/common/os/rctl.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/usr/src/uts/common/os/rctl.c b/usr/src/uts/common/os/rctl.c
index 38c86ad85e..41da98ee02 100644
--- a/usr/src/uts/common/os/rctl.c
+++ b/usr/src/uts/common/os/rctl.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/atomic.h>
#include <sys/cmn_err.h>
#include <sys/id_space.h>
@@ -2872,12 +2870,15 @@ rctl_init(void)
}
/*
- * rctl_incr_locked_mem(proc_t *p, kproject_t *proj, rctl_qty_t inc)
+ * rctl_incr_locked_mem(proc_t *p, kproject_t *proj, rctl_qty_t inc,
+ * int chargeproc)
*
* Increments the amount of locked memory on a project, and
- * zone. If proj is NULL, the proj and zone of proc_t p is used. If
- * chargeproc is non-zero, then the charged amount is cached on p->p_locked_mem
- * so that the charge can be migrated when a process changes projects.
+ * zone. If proj is non-NULL the project must be held by the
+ * caller; if it is NULL the proj and zone of proc_t p are used.
+ * If chargeproc is non-zero, then the charged amount is cached
+ * on p->p_locked_mem so that the charge can be migrated when a
+ * process changes projects.
*
* Return values
* 0 - success
@@ -2897,7 +2898,7 @@ rctl_incr_locked_mem(proc_t *p, kproject_t *proj, rctl_qty_t inc,
ASSERT(MUTEX_HELD(&p->p_lock));
if (proj != NULL) {
projp = proj;
- zonep = zone_find_by_id(projp->kpj_zoneid);
+ zonep = proj->kpj_zone;
} else {
projp = p->p_task->tk_proj;
zonep = p->p_zone;
@@ -2932,18 +2933,18 @@ rctl_incr_locked_mem(proc_t *p, kproject_t *proj, rctl_qty_t inc,
}
out:
mutex_exit(&zonep->zone_mem_lock);
- if (proj != NULL)
- zone_rele(zonep);
return (ret);
}
/*
- * rctl_decr_locked_mem(proc_t *p, kproject_t *proj, rctl_qty_t inc)
+ * rctl_decr_locked_mem(proc_t *p, kproject_t *proj, rctl_qty_t inc,
+ * int creditproc)
*
* Decrements the amount of locked memory on a project and
- * zone. If proj is NULL, the proj and zone of proc_t p is used. If
- * creditproc is non-zero, then the quantity of locked memory is subtracted
- * from p->p_locked_mem.
+ * zone. If proj is non-NULL the project must be held by the
+ * caller; if it is NULL the proj and zone of proc_t p are used.
+ * If creditproc is non-zero, then the quantity of locked memory
+ * is subtracted from p->p_locked_mem.
*
* Return values
* none
@@ -2957,7 +2958,7 @@ rctl_decr_locked_mem(proc_t *p, kproject_t *proj, rctl_qty_t inc,
if (proj != NULL) {
projp = proj;
- zonep = zone_find_by_id(projp->kpj_zoneid);
+ zonep = proj->kpj_zone;
} else {
ASSERT(p != NULL);
ASSERT(MUTEX_HELD(&p->p_lock));
@@ -2974,8 +2975,6 @@ rctl_decr_locked_mem(proc_t *p, kproject_t *proj, rctl_qty_t inc,
p->p_locked_mem -= inc;
}
mutex_exit(&zonep->zone_mem_lock);
- if (proj != NULL)
- zone_rele(zonep);
}
/*