Print this page


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 2012 Joyent, Inc.  All rights reserved.
       25 + * Copyright 2011 Joyent, Inc.  All rights reserved.
  26   26   */
  27   27  
  28   28  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  29   29  /*        All Rights Reserved   */
  30   30  
  31   31  #include <sys/param.h>
  32   32  #include <sys/types.h>
  33   33  #include <sys/sysmacros.h>
  34   34  #include <sys/systm.h>
  35   35  #include <sys/tuneable.h>
↓ open down ↓ 137 lines elided ↑ open up ↑
 173  173                  if (!INGLOBALZONE(curproc) &&
 174  174                      curproc->p_zone->zone_phys_mem_ctl != UINT64_MAX)
 175  175                          return (MIN(btop(curproc->p_zone->zone_phys_mem_ctl),
 176  176                              physinstalled));
 177  177  
 178  178                  return (physinstalled);
 179  179  
 180  180          case _CONFIG_AVPHYS_PAGES:
 181  181                  /*
 182  182                   * If the non-global zone has a phys. memory cap, use
 183      -                 * the phys. memory cap - zone's rss.  We always
      183 +                 * the phys. memory cap - zone's current rss.  We always
 184  184                   * report the system-wide value for the global zone, even
 185      -                 * though memory capping can be used on the global zone too.
 186      -                 * We use the cached value for the RSS since vm_getusage()
 187      -                 * is so expensive and we don't need this value to be exact.
      185 +                 * though rcapd can be used on the global zone too.
 188  186                   */
 189  187                  if (!INGLOBALZONE(curproc) &&
 190  188                      curproc->p_zone->zone_phys_mem_ctl != UINT64_MAX) {
 191  189                          pgcnt_t cap, rss, free;
      190 +                        vmusage_t in_use;
      191 +                        size_t cnt = 1;
 192  192  
 193  193                          cap = btop(curproc->p_zone->zone_phys_mem_ctl);
 194  194                          if (cap > physinstalled)
 195  195                                  return (freemem);
 196  196  
 197      -                        rss = btop(curproc->p_zone->zone_phys_mem);
      197 +                        if (vm_getusage(VMUSAGE_ZONE, 1, &in_use, &cnt,
      198 +                            FKIOCTL) != 0)
      199 +                                in_use.vmu_rss_all = 0;
      200 +                        rss = btop(in_use.vmu_rss_all);
 198  201                          /*
 199      -                         * Because this is a soft cap, it is possible
      202 +                         * Because rcapd implements a soft cap, it is possible
 200  203                           * for rss to be temporarily over the cap.
 201  204                           */
 202  205                          if (cap > rss)
 203  206                                  free = cap - rss;
 204  207                          else
 205  208                                  free = 0;
 206  209                          return (MIN(free, freemem));
 207  210                  }
 208  211  
 209  212                  return (freemem);
↓ open down ↓ 14 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX