lkml.org 
[lkml]   [2000]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Value of TASK_UNMAPPED_SIZE on 2.4

Hello,

On Fri, 3 Nov 2000, Josue Emmanuel Amaro wrote:

> It would be great if it could be a kernel configuration time option.

Something like the attached old patch for 2.2. It is very
optimistic in using 64MB as min value for TASK_UNMAPPED_BASE while
the real min is above 128MB (where malloc starts). May be needs tuning for
other archs. You still need to select good value for TASK_SIZE/PAGE_OFFSET
at compile time. I run the patch safely with
echo 195887104 > /proc/sys/kernel/task_unmapped_base


Regards

--
Julian Anastasov <ja@ssi.bg>
--- linux/include/linux/sysctl.h.orig Fri Dec 17 00:04:36 1999
+++ linux/include/linux/sysctl.h Fri Dec 17 00:22:26 1999
@@ -106,6 +106,7 @@
KERN_SYSRQ=38, /* int: Sysreq enable */
KERN_SHMALL=41, /* int: maximum size of shared memory */
KERN_SPARC_STOP_A=44, /* int: Sparc Stop-A enable */
+ KERN_TASK_UNMAPPED_BASE=45,
};


--- linux/kernel/sysctl.c.orig Fri Dec 17 00:04:36 1999
+++ linux/kernel/sysctl.c Fri Dec 17 00:25:59 1999
@@ -51,6 +51,12 @@
extern int shmall_max;
#endif

+#if defined(CONFIG_2GB) || defined(CONFIG_3GB) || defined(CONFIG_1GB)
+extern int min_task_unmapped_base;
+extern int cur_task_unmapped_base;
+extern int max_task_unmapped_base;
+#endif
+
#ifdef __sparc__
extern char reboot_command [];
extern int stop_a_enabled;
@@ -226,6 +232,11 @@
{KERN_SHMALL, "shmall", &shmall, sizeof (int),
0644, NULL, &proc_dointvec_minmax, &sysctl_intvec,
NULL, &zero_value, &shmall_max},
+#endif
+#if defined(CONFIG_2GB) || defined(CONFIG_3GB) || defined(CONFIG_1GB)
+ {KERN_TASK_UNMAPPED_BASE, "task_unmapped_base", &cur_task_unmapped_base, sizeof (int),
+ 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec,
+ NULL, &min_task_unmapped_base, &max_task_unmapped_base},
#endif
#ifdef CONFIG_MAGIC_SYSRQ
{KERN_SYSRQ, "sysrq", &sysrq_enabled, sizeof (int),
--- linux/mm/mmap.c.orig Fri Dec 17 00:04:36 1999
+++ linux/mm/mmap.c Fri Dec 17 00:28:11 1999
@@ -41,6 +41,12 @@

int sysctl_overcommit_memory;

+#if defined(CONFIG_2GB) || defined(CONFIG_3GB) || defined(CONFIG_1GB)
+int min_task_unmapped_base = 0x04000000;
+int cur_task_unmapped_base = TASK_UNMAPPED_BASE;
+int max_task_unmapped_base = 0x7FC00000;
+#endif
+
/* Check that a process has enough memory to allocate a
* new virtual mapping.
*/
@@ -362,7 +368,11 @@
if (len > TASK_SIZE)
return 0;
if (!addr)
+#if defined(CONFIG_2GB) || defined(CONFIG_3GB) || defined(CONFIG_1GB)
+ addr = (unsigned long) cur_task_unmapped_base;
+#else
addr = TASK_UNMAPPED_BASE;
+#endif
addr = PAGE_ALIGN(addr);

for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) {
\
 
 \ /
  Last update: 2005-03-22 12:45    [W:0.050 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site