Skip to contentSkip to conversation

Avoiding mmap fragmentation - clean rev

PATCH Chen, Kenneth W 2 participants 2 messages May 20, 2005 Memory management

lore
Share & tools
lore
#0 lore raw

Chen, Kenneth W wrote on Thursday, May 19, 2005 7:02 PM

Quoted 6 lines

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.

Oh, crap, there is a typo in my patch and it won't compile on x86_64. Here is an updated version. Please this one instead.

arch/ia64/kernel/sys_ia64.c renamed from arch/ia64/kernel/sys_ia64.c.orig +2 -11
@@ -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;
 	}
 }
arch/x86_64/kernel/sys_x86_64.c renamed from arch/x86_64/kernel/sys_x86_64.c.orig +1 -1
@@ -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 (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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 7 lines · Kenneth W

Chen, Kenneth W wrote on Thursday, May 19, 2005 7:02 PM

Quoted 6 lines

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.

Great! Makes more than perfect sense in the 64bit world.

Wolfgang
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>