diff -ur linux-2.2.17/include/linux/sched.h linux/include/linux/sched.h
--- linux-2.2.17/include/linux/sched.h	Sun Oct  1 00:05:42 2000
+++ linux/include/linux/sched.h	Sun Oct  1 18:47:12 2000
@@ -166,9 +166,6 @@
 	NULL, NULL \
 }
 
-/* Maximum number of active map areas. This is the number of pages that fit in
- * the address space */
-#define MAX_MAP_COUNT   (ULONG_MAX >> PAGE_SHIFT)
 
 /* Number of map areas at which the AVL tree is activated. This is arbitrary. */
 #define AVL_MIN_MAP_COUNT	32
diff -ur linux-2.2.17/include/linux/sysctl.h linux/include/linux/sysctl.h
--- linux-2.2.17/include/linux/sysctl.h	Wed Jun  7 16:26:44 2000
+++ linux/include/linux/sysctl.h	Sun Oct  1 18:50:31 2000
@@ -121,7 +121,8 @@
 	VM_PAGECACHE=7,		/* struct: Set cache memory thresholds */
 	VM_PAGERDAEMON=8,	/* struct: Control kswapd behaviour */
 	VM_PGT_CACHE=9,		/* struct: Set page table cache parameters */
-	VM_PAGE_CLUSTER=10	/* int: set number of pages to swap together */
+	VM_PAGE_CLUSTER=10,	/* int: set number of pages to swap together */
+	VM_MAX_MAP_COUNT=11	/* int: max number mappings per process */
 };
 
 
diff -ur linux-2.2.17/kernel/sysctl.c linux/kernel/sysctl.c
--- linux-2.2.17/kernel/sysctl.c	Wed Jun  7 16:26:44 2000
+++ linux/kernel/sysctl.c	Sun Oct  1 18:46:50 2000
@@ -37,6 +37,7 @@
 extern int bdf_prm[], bdflush_min[], bdflush_max[];
 extern char binfmt_java_interpreter[], binfmt_java_appletviewer[];
 extern int sysctl_overcommit_memory;
+extern int sysctl_max_map_count;
 extern int nr_queued_signals, max_queued_signals;
 
 #ifdef CONFIG_KMOD
@@ -252,6 +253,8 @@
 	 &pgt_cache_water, 2*sizeof(int), 0600, NULL, &proc_dointvec},
 	{VM_PAGE_CLUSTER, "page-cluster", 
 	 &page_cluster, sizeof(int), 0600, NULL, &proc_dointvec},
+	{VM_MAX_MAP_COUNT, "max_map_count", 
+	 &sysctl_max_map_count, sizeof(int), 0644, NULL, &proc_dointvec},
 	{0}
 };
 
diff -ur linux-2.2.17/mm/mmap.c linux/mm/mmap.c
--- linux-2.2.17/mm/mmap.c	Wed Jun  7 16:26:44 2000
+++ linux/mm/mmap.c	Sun Oct  1 18:51:23 2000
@@ -40,6 +40,7 @@
 kmem_cache_t *vm_area_cachep;
 
 int sysctl_overcommit_memory;
+int sysctl_max_map_count = 65536;
 
 /* Check that a process has enough memory to allocate a
  * new virtual mapping.
@@ -190,7 +191,7 @@
 		return -EINVAL;
 
 	/* Too many mappings? */
-	if (mm->map_count > MAX_MAP_COUNT)
+	if (mm->map_count > sysctl_max_map_count)
 		return -ENOMEM;
 
 	/* mlock MCL_FUTURE? */
@@ -632,7 +633,7 @@
 
 	/* If we'll make "hole", check the vm areas limit */
 	if ((mpnt->vm_start < addr && mpnt->vm_end > addr+len)
-	    && mm->map_count >= MAX_MAP_COUNT)
+	    && mm->map_count >= sysctl_max_map_count)
 		return -ENOMEM;
 
 	/*

