- Add documentation.

- It's an x86-only feature, so don't offer the sysctl on other architectures.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/Documentation/filesystems/proc.txt |    6 ++++++
 25-akpm/arch/i386/mm/mmap.c                |    5 ++++-
 25-akpm/include/asm-i386/page.h            |    4 ++--
 25-akpm/kernel/sysctl.c                    |    4 ++--
 4 files changed, 14 insertions(+), 5 deletions(-)

diff -puN Documentation/filesystems/proc.txt~legacy_va_layout-docs Documentation/filesystems/proc.txt
--- 25/Documentation/filesystems/proc.txt~legacy_va_layout-docs	2004-08-01 18:02:55.376287624 -0700
+++ 25-akpm/Documentation/filesystems/proc.txt	2004-08-01 18:02:55.386286104 -0700
@@ -1174,6 +1174,12 @@ for writeout by the pdflush daemons.  It
 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 i386 mmap layout - the kernel will
+use the legacy (2.4) layout for all processes.
+
 lower_zone_protection
 ---------------------
 
diff -puN kernel/sysctl.c~legacy_va_layout-docs kernel/sysctl.c
--- 25/kernel/sysctl.c~legacy_va_layout-docs	2004-08-01 18:02:55.378287320 -0700
+++ 25-akpm/kernel/sysctl.c	2004-08-01 21:20:27.477494368 -0700
@@ -149,8 +149,6 @@ extern ctl_table random_table[];
 extern ctl_table pty_table[];
 #endif
 
-int sysctl_legacy_va_layout;
-
 /* /proc declarations: */
 
 #ifdef CONFIG_PROC_FS
@@ -807,6 +805,7 @@ static ctl_table vm_table[] = {
 		.strategy	= &sysctl_intvec,
 		.extra1		= &zero,
 	},
+#ifdef __i386__
 	{
 		.ctl_name	= VM_LEGACY_VA_LAYOUT,
 		.procname	= "legacy_va_layout",
@@ -817,6 +816,7 @@ static ctl_table vm_table[] = {
 		.strategy	= &sysctl_intvec,
 		.extra1		= &zero,
 	},
+#endif
 	{ .ctl_name = 0 }
 };
 
diff -puN include/asm-i386/page.h~legacy_va_layout-docs include/asm-i386/page.h
--- 25/include/asm-i386/page.h~legacy_va_layout-docs	2004-08-01 18:02:55.379287168 -0700
+++ 25-akpm/include/asm-i386/page.h	2004-08-01 21:20:13.260655656 -0700
@@ -118,6 +118,8 @@ static __inline__ int get_order(unsigned
 
 extern int devmem_is_allowed(unsigned long pagenr);
 
+extern int sysctl_legacy_va_layout;
+
 #endif /* __ASSEMBLY__ */
 
 #ifdef __ASSEMBLY__
@@ -147,8 +149,6 @@ extern int devmem_is_allowed(unsigned lo
 	((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
 		 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
-
-
 #endif /* __KERNEL__ */
 
 #endif /* _I386_PAGE_H */
diff -puN arch/i386/mm/mmap.c~legacy_va_layout-docs arch/i386/mm/mmap.c
--- 25/arch/i386/mm/mmap.c~legacy_va_layout-docs	2004-08-01 18:02:55.381286864 -0700
+++ 25-akpm/arch/i386/mm/mmap.c	2004-08-01 18:02:55.388285800 -0700
@@ -35,6 +35,8 @@
 #define MIN_GAP (128*1024*1024)
 #define MAX_GAP (TASK_SIZE/6*5)
 
+int sysctl_legacy_va_layout;
+
 static inline unsigned long mmap_base(struct mm_struct *mm)
 {
 	unsigned long gap = current->rlim[RLIMIT_STACK].rlim_cur;
@@ -57,7 +59,8 @@ void arch_pick_mmap_layout(struct mm_str
 	 * Fall back to the standard layout if the personality
 	 * bit is set, or if the expected stack growth is unlimited:
 	 */
-	if (sysctl_legacy_va_layout || (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;
_