Re: your mail

From: Maciej Zenczykowski
Date: Tue Feb 10 2004 - 20:11:47 EST


On Tue, 10 Feb 2004, Bloch, Jack wrote:

> 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)
> {

it's valid there's no point in searching further for an area of at least
len bytes. The user area is 0 .. TASK_SIZE-1. The addr is the address
currently being checked, the len is the requested length. if addr+len is
greater or equal to TASK_SIZE then the current addr (which is increasing
within this loop) already causes such a mapping to overflow into kernel
space (exceeds the TASK_SIZE virtual address limit). This is precisely as
expected.

I'd assume your program has fragmented memory to such a level that a
single consecutive 100 MB area is no longer free (not that hard to do,
since TASK_SIZE is 3 GB).

Cheers,
MaZe.


-
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/