[no subject]

From: Bloch, Jack
Date: Tue Feb 10 2004 - 18:39:12 EST


I have a system with 2GB of memory. One of my processes calls mmap to try to
map a 100MB file into memory. This calls fails with -ENOMEM. I rebuilt the
kernel with a few debug printk statements in mmap.c to see where the failure
was occurring it occurred in the function arch_get_unmapped_area. the code
is as follows:

for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
/* At this point: (!vma || addr < vma->vm_end). */
unsigned long __heap_stack_gap;
if (TASK_SIZE - len < addr)
{
printk("%d TASK SIZE - LEN LESS THAN
ADDR\n",__LINE__);
return -ENOMEM;
}
if (!found_hole && (!vma || addr < vma->vm_start)) {
mm->free_area_cache = addr;
found_hole = 1;
}
if (!vma)
return addr;
__heap_stack_gap = 0;
if (vma->vm_flags & VM_GROWSDOWN)
__heap_stack_gap = heap_stack_gap << PAGE_SHIFT;
if (addr + len + __heap_stack_gap <= vma->vm_start)
return addr;
addr = vma->vm_end;
}

The printk is mine. What exactly is meant by the fact that TASK_SIZE - len <
addr?

Regards,


Jack Bloch
Siemens ICN
phone (561) 923-6550
e-mail jack.bloch@xxxxxxxxxxxxxxx

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/