Re: Out of Memory (2.1.12[89])

Andrea Arcangeli (andrea@e-mind.com)
Mon, 23 Nov 1998 00:29:51 +0100 (CET)


On Sun, 22 Nov 1998, Mark Lord wrote:

>christophe leroy wrote:
>>
>> While running following programs, after forking about 350 process,
>> fork() returns Out of Memory, whereas I still have 576kbytes RAM free

libc is used to tell oom when we have just forked
NR_TASKS-MIN_TASKS_LEFT_FOR_ROOT.

>> and 96Mbytes free swap.

And btw, fork alloc the kernel stack and there's no way to swapout it. But
I guess you are experiencing the number of task limit.

>It's not just fork (or, then, maybe it is ..)
>
>I see bogus "out of memory" errors when running "find"
>and "diff --recursive" under the latest kernels.

You see them from the kernel or from libc?

My arca-28 has a better kswapd that probably will fix the thing for you.
But the point is that kswapd should _only_ improve the swapout process and
should be not needed at all. This because a RT process will not be helped
by kswapd...

You can try to edit mm/vmscan.c in try_to_free_pages() and change this
code:

if (!(current->flags & PF_MEMALLOC)) {
current->flags |= PF_MEMALLOC;
do {
retval = do_try_to_free_page(gfp_mask);
if (!retval)
break;
count--;
} while (count > 0);
current->flags &= ~PF_MEMALLOC;
}

to:

if (!(current->flags & PF_MEMALLOC)) {
current->flags |= PF_MEMALLOC;
retval = 0;
do {
retval |= do_try_to_free_page(gfp_mask);
count--;
} while (count > 0);
current->flags &= ~PF_MEMALLOC;
}

I suspect this could reinsert the oom hang but should sure fix the not
wanted process kill due oom.

Andrea Arcangeli

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