From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200505200202.j4K22Fg06686@unix-os.sc.intel.com> From: "Chen, Kenneth W" Subject: RE: [PATCH] Avoiding mmap fragmentation - clean rev Date: Thu, 19 May 2005 19:02:15 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: <20050519155441.7a8e94f9.akpm@osdl.org> Sender: owner-linux-mm@kvack.org Return-Path: To: 'Andrew Morton' , Wolfgang Wander Cc: herve@elma.fr, mingo@elte.hu, arjanv@redhat.com, linux-mm@kvack.org List-ID: Andrew Morton wrote on Thursday, May 19, 2005 3:55 PM > Wolfgang Wander wrote: > > > > Clearly one has to weight the performance issues against the memory > > efficiency but since we demonstratibly throw away 25% (or 1GB) of the > > available address space in the various accumulated holes a long > > running application can generate > > That sounds pretty bad. > > > I hope that for the time being we can > > stick with my first solution, > > I'm inclined to do this. Oh well, I guess we have to take a performance hit here in favor of functionality. Though this is a problem specific to 32-bit address space, please don't unnecessarily penalize 64-bit arch. If Andrew is going to take Wolfgang's patch, then we should minimally take the following patch. This patch revert changes made in arch/ia64 and make x86_64 to use alternate cache algorithm for 32-bit app. Signed-off-by: Ken Chen --- linux-2.6.11/arch/ia64/kernel/sys_ia64.c.orig 2005-05-19 18:35:31.468087777 -0700 +++ linux-2.6.11/arch/ia64/kernel/sys_ia64.c 2005-05-19 18:35:46.521798000 -0700 @@ -38,14 +38,8 @@ arch_get_unmapped_area (struct file *fil if (REGION_NUMBER(addr) == REGION_HPAGE) addr = 0; #endif - if (!addr) { - if (len > mm->cached_hole_size) { - addr = mm->free_area_cache; - } else { - addr = TASK_UNMAPPED_BASE; - mm->cached_hole_size = 0; - } - } + if (!addr) + addr = mm->free_area_cache; if (map_shared && (TASK_SIZE > 0xfffffffful)) /* @@ -65,7 +59,6 @@ arch_get_unmapped_area (struct file *fil if (start_addr != TASK_UNMAPPED_BASE) { /* Start a new search --- just in case we missed some holes. */ addr = TASK_UNMAPPED_BASE; - mm->cached_hole_size = 0; goto full_search; } return -ENOMEM; @@ -75,8 +68,6 @@ arch_get_unmapped_area (struct file *fil mm->free_area_cache = addr + len; return addr; } - if (addr + mm->cached_hole_size < vma->vm_start) - mm->cached_hole_size = vma->vm_start - addr; addr = (vma->vm_end + align_mask) & ~align_mask; } } --- linux-2.6.11/arch/x86_64/kernel/sys_x86_64.c.orig 2005-05-19 18:37:32.202461298 -0700 +++ linux-2.6.11/arch/x86_64/kernel/sys_x86_64.c 2005-05-19 18:39:03.110663309 -0700 @@ -111,7 +111,7 @@ arch_get_unmapped_area(struct file *filp (!vma || addr + len <= vma->vm_start)) return addr; } - if (len <= mm->cached_hole_size) { + if (if begin != TASK_UNMAPPED_64 && len <= mm->cached_hole_size) { mm->cached_hole_size = 0; mm->free_area_cache = begin; } -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: aart@kvack.org