File: proc_map-linux-2.2.18.patch

package info (click to toggle)
njamd 0.9.3pre2-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,704 kB
  • ctags: 1,056
  • sloc: ansic: 9,367; sh: 7,921; makefile: 121; perl: 52
file content (62 lines) | stat: -rw-r--r-- 2,239 bytes parent folder | download
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
diff -ur linux-2.2.18-orig/include/linux/sysctl.h linux-2.2.18/include/linux/sysctl.h
--- linux-2.2.18-orig/include/linux/sysctl.h	Sun Dec 10 18:49:44 2000
+++ linux-2.2.18/include/linux/sysctl.h	Tue Jan 30 16:42:20 2001
@@ -123,7 +123,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.18-orig/kernel/sysctl.c linux-2.2.18/kernel/sysctl.c
--- linux-2.2.18-orig/kernel/sysctl.c	Sun Dec 10 18:49:44 2000
+++ linux-2.2.18/kernel/sysctl.c	Tue Jan 30 16:42:20 2001
@@ -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
@@ -272,6 +273,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.18-orig/mm/mmap.c linux-2.2.18/mm/mmap.c
--- linux-2.2.18-orig/mm/mmap.c	Sun Dec 10 18:49:44 2000
+++ linux-2.2.18/mm/mmap.c	Tue Jan 30 16:42:20 2001
@@ -40,6 +40,7 @@
 kmem_cache_t *vm_area_cachep;
 
 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.
@@ -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;
 
 	/*