
From: Wolfgang Wander <wwc@rentec.com>

Since rc6 the difference between TASK_UNMAPPED_64 and TASK_UNMAPPED_32 is
gone and both are now merged into TASK_UNMAPPED_BASE.  Therefore we can no
longer check our local base against TASK_UNMAPPED_BASE to see if we are
running in 32bit emulation mode.  The appended patch uses other (hopefully
the right) means.

Tested on x86_64 in 32 and 64 mode (64 bit fragments as desired, 32 bit
collapses as desired).

Signed-off-by: Wolfgang Wander <wwc@rentec.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 arch/x86_64/kernel/sys_x86_64.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN arch/x86_64/kernel/sys_x86_64.c~avoiding-mmap-fragmentation-revert-unneeded-64-bit-changes-vs-x86_64-task_size-fixes-for-compatibility-mode-processes-fix arch/x86_64/kernel/sys_x86_64.c
--- 25/arch/x86_64/kernel/sys_x86_64.c~avoiding-mmap-fragmentation-revert-unneeded-64-bit-changes-vs-x86_64-task_size-fixes-for-compatibility-mode-processes-fix	2005-06-07 20:47:03.000000000 -0700
+++ 25-akpm/arch/x86_64/kernel/sys_x86_64.c	2005-06-07 20:47:03.000000000 -0700
@@ -105,7 +105,8 @@ arch_get_unmapped_area(struct file *filp
 		    (!vma || addr + len <= vma->vm_start))
 			return addr;
 	}
-	if (begin != TASK_UNMAPPED_BASE && len <= mm->cached_hole_size) {
+	if (((flags & MAP_32BIT) || test_thread_flag(TIF_IA32))
+	    && len <= mm->cached_hole_size) {
 	        mm->cached_hole_size = 0;
 		mm->free_area_cache = begin;
 	}
_
