diff options
| author | gjelinek <none@none> | 2006-12-14 13:35:17 -0800 |
|---|---|---|
| committer | gjelinek <none@none> | 2006-12-14 13:35:17 -0800 |
| commit | 0209230bf1261579beab4f55226bb509e6b850cb (patch) | |
| tree | c605b4105191d5a10962c524ad08019742cd52cb /usr/src/uts/common/vm/vm_seg.c | |
| parent | 780774645a5b1b0176916fc66312dc1d9b4d14b4 (diff) | |
| download | illumos-joyent-0209230bf1261579beab4f55226bb509e6b850cb.tar.gz | |
PSARC 2006/496 Improved Zones/RM Integration
PSARC 2006/598 Swap resource control; locked memory RM improvements
PSARC 2006/660 rcapadm zone option
4754856 *prstat* prstat -atJTZ should count shared segments only once
4970603 RFE: should be able to persistently specify global zone's cpu shares
5026227 RFE: ability to rcap zones from global zone
5103071 RFE: local zones can run the global zone out of swap
6222025 RFE: simplify rctl syntax and improve cpu-shares/FSS interaction
6420985 rcapstat is broken on amd64
6421202 RFE: simplify and improve zones/pool integration
6442252 zonecfg's "unset" syntax is not documented and confusing
6490516 schedctl pages should not reserve swap
6490938 setproject can bind to the wrong pool
6498635 zone attach failure leaves zone in installed state
6500877 tmpfs syslogs incorrect path when non-global zone tmpfs mounts become full
Diffstat (limited to 'usr/src/uts/common/vm/vm_seg.c')
| -rw-r--r-- | usr/src/uts/common/vm/vm_seg.c | 56 |
1 files changed, 51 insertions, 5 deletions
diff --git a/usr/src/uts/common/vm/vm_seg.c b/usr/src/uts/common/vm/vm_seg.c index 50cc21cdf7..aed892969d 100644 --- a/usr/src/uts/common/vm/vm_seg.c +++ b/usr/src/uts/common/vm/vm_seg.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -54,12 +53,14 @@ #include <sys/cmn_err.h> #include <sys/callb.h> #include <sys/mem_config.h> +#include <sys/mman.h> #include <vm/hat.h> #include <vm/as.h> #include <vm/seg.h> #include <vm/seg_kmem.h> - +#include <vm/seg_spt.h> +#include <vm/seg_vn.h> /* * kstats for segment advise */ @@ -950,3 +951,48 @@ seg_pinit_mem_config(void) */ ASSERT(ret == 0); } + +extern struct seg_ops segvn_ops; +extern struct seg_ops segspt_shmops; + +/* + * Verify that segment is not a shared anonymous segment which reserves + * swap. zone.max-swap accounting (zone->zone_max_swap) cannot be transfered + * from one zone to another if any segments are shared. This is because the + * last process to exit will credit the swap reservation. This could lead + * to the swap being reserved by one zone, and credited to another. + */ +boolean_t +seg_can_change_zones(struct seg *seg) +{ + struct segvn_data *svd; + + if (seg->s_ops == &segspt_shmops) + return (B_FALSE); + + if (seg->s_ops == &segvn_ops) { + svd = (struct segvn_data *)seg->s_data; + if (svd->type == MAP_SHARED && + svd->amp != NULL && + svd->amp->swresv > 0) + return (B_FALSE); + } + return (B_TRUE); +} + +/* + * Return swap reserved by a segment backing a private mapping. + */ +size_t +seg_swresv(struct seg *seg) +{ + struct segvn_data *svd; + size_t swap = 0; + + if (seg->s_ops == &segvn_ops) { + svd = (struct segvn_data *)seg->s_data; + if (svd->type == MAP_PRIVATE && svd->swresv > 0) + swap = svd->swresv; + } + return (swap); +} |
