Print this page
OS-399 zone phys. mem. cap should be a rctl and have associated kstat

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/syscall/sysconfig.c
          +++ new/usr/src/uts/common/syscall/sysconfig.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
       25 + * Copyright 2011 Joyent, Inc.  All rights reserved.
  25   26   */
  26   27  
  27   28  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  28   29  /*        All Rights Reserved   */
  29   30  
  30   31  #include <sys/param.h>
  31   32  #include <sys/types.h>
  32   33  #include <sys/sysmacros.h>
  33   34  #include <sys/systm.h>
  34   35  #include <sys/tuneable.h>
↓ open down ↓ 128 lines elided ↑ open up ↑
 163  164          case _CONFIG_TIMER_MAX:
 164  165                  return (timer_max);
 165  166  
 166  167          case _CONFIG_PHYS_PAGES:
 167  168                  /*
 168  169                   * If the non-global zone has a phys. memory cap, use that.
 169  170                   * We always report the system-wide value for the global zone,
 170  171                   * even though rcapd can be used on the global zone too.
 171  172                   */
 172  173                  if (!INGLOBALZONE(curproc) &&
 173      -                    curproc->p_zone->zone_phys_mcap != 0)
 174      -                        return (MIN(btop(curproc->p_zone->zone_phys_mcap),
      174 +                    curproc->p_zone->zone_phys_mem_ctl != UINT64_MAX)
      175 +                        return (MIN(btop(curproc->p_zone->zone_phys_mem_ctl),
 175  176                              physinstalled));
 176  177  
 177  178                  return (physinstalled);
 178  179  
 179  180          case _CONFIG_AVPHYS_PAGES:
 180  181                  /*
 181  182                   * If the non-global zone has a phys. memory cap, use
 182  183                   * the phys. memory cap - zone's current rss.  We always
 183  184                   * report the system-wide value for the global zone, even
 184  185                   * though rcapd can be used on the global zone too.
 185  186                   */
 186  187                  if (!INGLOBALZONE(curproc) &&
 187      -                    curproc->p_zone->zone_phys_mcap != 0) {
      188 +                    curproc->p_zone->zone_phys_mem_ctl != UINT64_MAX) {
 188  189                          pgcnt_t cap, rss, free;
 189  190                          vmusage_t in_use;
 190  191                          size_t cnt = 1;
 191  192  
 192      -                        cap = btop(curproc->p_zone->zone_phys_mcap);
      193 +                        cap = btop(curproc->p_zone->zone_phys_mem_ctl);
 193  194                          if (cap > physinstalled)
 194  195                                  return (freemem);
 195  196  
 196  197                          if (vm_getusage(VMUSAGE_ZONE, 1, &in_use, &cnt,
 197  198                              FKIOCTL) != 0)
 198  199                                  in_use.vmu_rss_all = 0;
 199  200                          rss = btop(in_use.vmu_rss_all);
 200  201                          /*
 201  202                           * Because rcapd implements a soft cap, it is possible
 202  203                           * for rss to be temporarily over the cap.
↓ open down ↓ 23 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX