Print this page
        
@@ -19,11 +19,11 @@
  * CDDL HEADER END
  */
 /*
  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
- * Copyright 2016 Joyent, Inc.
+ * Copyright 2015, Joyent, Inc.  All rights reserved.
  * Copyright (c) 2016 by Delphix. All rights reserved.
  */
 
 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
 /*        All Rights Reserved   */
@@ -70,12 +70,10 @@
 #include <vm/seg_spt.h>
 #include <vm/page.h>
 
 clock_t deadlk_wait = 1; /* number of ticks to wait before retrying */
 
-ulong_t as_user_seg_limit = 0xffff; /* max segments in an (non-kas) AS */
-
 static struct kmem_cache *as_cache;
 
 static void as_setwatchprot(struct as *, caddr_t, size_t, uint_t);
 static void as_clearwatchprot(struct as *, caddr_t, size_t);
 int as_map_locked(struct as *, caddr_t, size_t, int ((*)()), void *);
@@ -889,24 +887,24 @@
                 if (as == &kas)
                         CPU_STATS_ADDQ(CPU, vm, kernel_asflt, 1);
                 CPU_STATS_EXIT_K();
                 if (zonep->zone_pg_flt_delay != 0) {
                         /*
-                         * The zone in which this process is running is
-                         * currently over it's physical memory cap. Throttle
-                         * page faults to help the user-land memory capper
-                         * catch up. Note that drv_usectohz() rounds up.
+                         * The zone in which this process is running
+                         * is currently over it's physical memory cap.
+                         * Throttle page faults to help the user-land
+                         * memory capper catch up. Note that
+                         * drv_usectohz() rounds up.
                          */
                         atomic_add_64(&zonep->zone_pf_throttle, 1);
                         atomic_add_64(&zonep->zone_pf_throttle_usec,
                             zonep->zone_pg_flt_delay);
-                        if (zonep->zone_pg_flt_delay < TICK_TO_USEC(1)) {
+                        if (zonep->zone_pg_flt_delay < TICK_TO_USEC(1))
                                 drv_usecwait(zonep->zone_pg_flt_delay);
-                        } else {
+                        else
                                 delay(drv_usectohz(zonep->zone_pg_flt_delay));
                         }
-                }
                 break;
         }
 
         /* Kernel probe */
         TNF_PROBE_3(address_fault, "vm pagefault", /* CSTYLED */,
@@ -1709,33 +1707,18 @@
         }
 
         as->a_updatedir = 1;    /* inform /proc */
         gethrestime(&as->a_updatetime);
 
-        if (as != &kas) {
-                if (as->a_size + rsize > (size_t)p->p_vmem_ctl) {
+        if (as != &kas && as->a_size + rsize > (size_t)p->p_vmem_ctl) {
                         AS_LOCK_EXIT(as);
 
-                        (void) rctl_action(rctlproc_legacy[RLIMIT_VMEM],
-                            p->p_rctls, p, RCA_UNSAFE_ALL);
-                        return (ENOMEM);
-                }
+                (void) rctl_action(rctlproc_legacy[RLIMIT_VMEM], p->p_rctls, p,
+                    RCA_UNSAFE_ALL);
 
-                /*
-                 * Keep the number of segments in a userspace AS constrained to
-                 * a reasonable limit.  Linux enforces a value slightly less
-                 * than 64k in order to avoid ELF limits if/when a process
-                 * dumps core.  While SunOS avoids that specific problem with
-                 * other tricks, the limit is still valuable to keep kernel
-                 * memory consumption in check.
-                 */
-                if (avl_numnodes(&as->a_segtree) >= as_user_seg_limit) {
-                        AS_LOCK_EXIT(as);
-                        atomic_inc_32(&p->p_zone->zone_mfseglim);
                         return (ENOMEM);
                 }
-        }
 
         if (AS_MAP_CHECK_VNODE_LPOOB(crfp, argsp)) {
                 crargs = *(struct segvn_crargs *)argsp;
                 error = as_map_vnsegs(as, raddr, rsize, crfp, &crargs, &unmap);
                 if (error != 0) {