* (no subject)
@ 2004-02-10 23:36 Bloch, Jack
2004-02-11 1:09 ` your mail Maciej Zenczykowski
0 siblings, 1 reply; 2+ messages in thread
From: Bloch, Jack @ 2004-02-10 23:36 UTC (permalink / raw)
To: linux-kernel
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@icn.siemens.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: your mail
2004-02-10 23:36 Bloch, Jack
@ 2004-02-11 1:09 ` Maciej Zenczykowski
0 siblings, 0 replies; 2+ messages in thread
From: Maciej Zenczykowski @ 2004-02-11 1:09 UTC (permalink / raw)
To: Bloch, Jack; +Cc: linux-kernel
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-11 1:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-10 23:36 Bloch, Jack
2004-02-11 1:09 ` your mail Maciej Zenczykowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).