summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjan van de Ven <arjanv@redhat.com>2004-08-23 21:12:13 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-23 21:12:13 -0700
commit64e3b6b67906efd7dcd2e50e8dc561cef86e5ce0 (patch)
tree716dc2d96178b5c78f90d73f07974d0a1dbb88ff
parent8fead718405ab6e11125661b3a1e29a9d3fe233c (diff)
[PATCH] sysctl tunable for flexmmap
Create /proc/sys/vm/legacy_va_layout. If this is non-zero, the kernel will use the old mmap layout for all tasks. it presently defaults to zero (the new layout). From: William Lee Irwin III <wli@holomorphy.com> hugetlb CONFIG_SYSCTL=n fix Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--Documentation/filesystems/proc.txt6
-rw-r--r--arch/i386/mm/mmap.c3
-rw-r--r--include/asm-i386/page.h2
-rw-r--r--include/linux/mm.h6
-rw-r--r--include/linux/sysctl.h1
-rw-r--r--kernel/sysctl.c17
-rw-r--r--mm/hugetlb.c2
7 files changed, 35 insertions, 2 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 186f38c13af1..2d80367e46ec 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1174,6 +1174,12 @@ for writeout by the pdflush daemons. It is expressed in 100'ths of a second.
Data which has been dirty in-memory for longer than this interval will be
written out next time a pdflush daemon wakes up.
+legacy_va_layout
+----------------
+
+If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernel
+will use the legacy (2.4) layout for all processes.
+
lower_zone_protection
---------------------
diff --git a/arch/i386/mm/mmap.c b/arch/i386/mm/mmap.c
index 5bee895efd55..a6270ee14323 100644
--- a/arch/i386/mm/mmap.c
+++ b/arch/i386/mm/mmap.c
@@ -57,7 +57,8 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
* Fall back to the standard layout if the personality
* bit is set, or if the expected stack growth is unlimited:
*/
- if ((current->personality & ADDR_COMPAT_LAYOUT) ||
+ if (sysctl_legacy_va_layout ||
+ (current->personality & ADDR_COMPAT_LAYOUT) ||
current->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY) {
mm->mmap_base = TASK_UNMAPPED_BASE;
mm->get_unmapped_area = arch_get_unmapped_area;
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index eb0e11f10683..fc3fb25278de 100644
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -116,6 +116,8 @@ static __inline__ int get_order(unsigned long size)
return order;
}
+extern int sysctl_legacy_va_layout;
+
#endif /* __ASSEMBLY__ */
#ifdef __ASSEMBLY__
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b7859da6d333..5849420e912e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -26,6 +26,12 @@ extern void * high_memory;
extern unsigned long vmalloc_earlyreserve;
extern int page_cluster;
+#ifdef CONFIG_SYSCTL
+extern int sysctl_legacy_va_layout;
+#else
+#define sysctl_legacy_va_layout 0
+#endif
+
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/processor.h>
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index afd89be7c193..bec509e874de 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -166,6 +166,7 @@ enum
VM_BLOCK_DUMP=24, /* block dump mode */
VM_HUGETLB_GROUP=25, /* permitted hugetlb group */
VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */
+ VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */
};
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 2c5c58279f81..4a361348038e 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -42,6 +42,7 @@
#include <linux/dcache.h>
#include <asm/uaccess.h>
+#include <asm/processor.h>
#ifdef CONFIG_ROOT_NFS
#include <linux/nfs_fs.h>
@@ -149,6 +150,10 @@ extern ctl_table random_table[];
extern ctl_table pty_table[];
#endif
+#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
+int sysctl_legacy_va_layout;
+#endif
+
/* /proc declarations: */
#ifdef CONFIG_PROC_FS
@@ -805,6 +810,18 @@ static ctl_table vm_table[] = {
.strategy = &sysctl_intvec,
.extra1 = &zero,
},
+#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
+ {
+ .ctl_name = VM_LEGACY_VA_LAYOUT,
+ .procname = "legacy_va_layout",
+ .data = &sysctl_legacy_va_layout,
+ .maxlen = sizeof(sysctl_legacy_va_layout),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ .strategy = &sysctl_intvec,
+ .extra1 = &zero,
+ },
+#endif
{ .ctl_name = 0 }
};
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 6c522e127033..3c96ecf1b5a1 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -123,6 +123,7 @@ static int __init hugetlb_setup(char *s)
}
__setup("hugepages=", hugetlb_setup);
+#ifdef CONFIG_SYSCTL
static void update_and_free_page(struct page *page)
{
int i;
@@ -188,7 +189,6 @@ static unsigned long set_max_huge_pages(unsigned long count)
return nr_huge_pages;
}
-#ifdef CONFIG_SYSCTL
int hugetlb_sysctl_handler(struct ctl_table *table, int write,
struct file *file, void __user *buffer,
size_t *length, loff_t *ppos)