1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
diff -ur linux.old/include/linux/sysctl.h linux/include/linux/sysctl.h
--- linux.old/include/linux/sysctl.h Fri May 11 13:00:21 2001
+++ linux/include/linux/sysctl.h Tue May 22 20:02:59 2001
@@ -134,7 +134,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.old/kernel/sysctl.c linux/kernel/sysctl.c
--- linux.old/kernel/sysctl.c Fri May 11 12:42:14 2001
+++ linux/kernel/sysctl.c Tue May 22 20:02:59 2001
@@ -43,6 +43,7 @@
extern int panic_timeout;
extern int C_A_D;
extern int bdf_prm[], bdflush_min[], bdflush_max[];
+extern int sysctl_max_map_count;
extern int sysctl_overcommit_memory;
extern int max_threads;
extern int nr_queued_signals, max_queued_signals;
@@ -270,7 +271,9 @@
&pgt_cache_water, 2*sizeof(int), 0644, NULL, &proc_dointvec},
{VM_PAGE_CLUSTER, "page-cluster",
&page_cluster, sizeof(int), 0644, NULL, &proc_dointvec},
- {0}
+ {VM_MAX_MAP_COUNT, "max_map_count", &sysctl_max_map_count,
+ sizeof(sysctl_max_map_count), 0644, NULL, &proc_dointvec},
+ {0}
};
static ctl_table proc_table[] = {
diff -ur linux.old/mm/filemap.c linux/mm/filemap.c
--- linux.old/mm/filemap.c Fri May 11 12:42:14 2001
+++ linux/mm/filemap.c Tue May 22 20:02:59 2001
@@ -28,6 +28,8 @@
#include <linux/highmem.h>
+extern int sysctl_max_map_count;
+
/*
* Shared mappings implemented 30.11.1994. It's not fully working yet,
* though.
@@ -1958,7 +1960,7 @@
int error = 0;
/* This caps the number of vma's this process can own */
- if (vma->vm_mm->map_count > MAX_MAP_COUNT)
+ if (vma->vm_mm->map_count > sysctl_max_map_count)
return -ENOMEM;
if (start == vma->vm_start) {
diff -ur linux.old/mm/mmap.c linux/mm/mmap.c
--- linux.old/mm/mmap.c Fri May 11 12:42:14 2001
+++ linux/mm/mmap.c Tue May 22 20:02:59 2001
@@ -38,6 +38,7 @@
};
int sysctl_overcommit_memory;
+int sysctl_max_map_count = MAX_MAP_COUNT;
/* Check that a process has enough memory to allocate a
* new virtual mapping.
@@ -227,7 +228,8 @@
return -EINVAL;
/* Too many mappings? */
- if (mm->map_count > MAX_MAP_COUNT)
+
+ if (mm->map_count > sysctl_max_map_count)
return -ENOMEM;
/* Obtain the address to map to. we verify (or select) it and ensure
@@ -730,7 +732,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;
/*
@@ -848,7 +850,7 @@
> current->rlim[RLIMIT_AS].rlim_cur)
return -ENOMEM;
- if (mm->map_count > MAX_MAP_COUNT)
+ if (mm->map_count > sysctl_max_map_count)
return -ENOMEM;
if (!vm_enough_memory(len >> PAGE_SHIFT))
|