summaryrefslogtreecommitdiff
path: root/usr/src/cmd/zoneadmd
diff options
context:
space:
mode:
authorMenno Lageman <Menno.Lageman@Sun.COM>2010-06-29 02:03:28 -0700
committerMenno Lageman <Menno.Lageman@Sun.COM>2010-06-29 02:03:28 -0700
commitff19e029e81c950f4e0f40f1f1ee1f7d8f8d8041 (patch)
tree1dd3e8563f991d5f5525997320033ae6742031ac /usr/src/cmd/zoneadmd
parente2449ddf2ae27a6dd79f8605a10fbc4082aba5f7 (diff)
downloadillumos-joyent-ff19e029e81c950f4e0f40f1f1ee1f7d8f8d8041.tar.gz
PSARC 2009/042 max-processes rctl
6631612 non-global zone can overrun the process table of the system 6466380 Project resource set callbacks are needlessly called on every fork() 6516818 task resource callbacks are needlessly called on every fork()
Diffstat (limited to 'usr/src/cmd/zoneadmd')
-rw-r--r--usr/src/cmd/zoneadmd/vplat.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/usr/src/cmd/zoneadmd/vplat.c b/usr/src/cmd/zoneadmd/vplat.c
index 0d0f8e4ebf..c29920be39 100644
--- a/usr/src/cmd/zoneadmd/vplat.c
+++ b/usr/src/cmd/zoneadmd/vplat.c
@@ -131,6 +131,9 @@
#define ALT_MOUNT(mount_cmd) ((mount_cmd) != Z_MNT_BOOT)
+/* a reasonable estimate for the number of lwps per process */
+#define LWPS_PER_PROCESS 10
+
/* for routing socket */
static int rts_seqno = 0;
@@ -2924,6 +2927,8 @@ get_rctls(zlog_t *zlogp, char **bufp, size_t *bufsizep)
zone_dochandle_t handle;
struct zone_rctltab rctltab;
rctlblk_t *rctlblk = NULL;
+ uint64_t maxlwps;
+ uint64_t maxprocs;
*bufp = NULL;
*bufsizep = 0;
@@ -2944,6 +2949,23 @@ get_rctls(zlog_t *zlogp, char **bufp, size_t *bufsizep)
goto out;
}
+ /*
+ * Allow the administrator to control both the maximum number of
+ * process table slots and the maximum number of lwps with just the
+ * max-processes property. If only the max-processes property is set,
+ * we add a max-lwps property with a limit derived from max-processes.
+ */
+ if (zonecfg_get_aliased_rctl(handle, ALIAS_MAXPROCS, &maxprocs)
+ == Z_OK &&
+ zonecfg_get_aliased_rctl(handle, ALIAS_MAXLWPS, &maxlwps)
+ == Z_NO_ENTRY) {
+ if (zonecfg_set_aliased_rctl(handle, ALIAS_MAXLWPS,
+ maxprocs * LWPS_PER_PROCESS) != Z_OK) {
+ zerror(zlogp, B_FALSE, "unable to set max-lwps alias");
+ goto out;
+ }
+ }
+
if (zonecfg_setrctlent(handle) != Z_OK) {
zerror(zlogp, B_FALSE, "%s failed", "zonecfg_setrctlent");
goto out;