Memory Management (was Re: [2.1.37] locks too)

Benjamin C R LaHaise (blah@dot.superaje.com)
Fri, 30 May 1997 13:56:11 +0000 ( )


On Fri, 30 May 1997, Andrea Arcangeli wrote:

> I was trying the stability of [2.1.37] opening 20/30 session of Netscape.
> No problem doing it. Then, satisfied, I closed all Netscape session and
> I lauched:
>
> rm -r /usr/src/linux-2.1.xx
>
> The kernel locks as [2.1.38] using Netscape.
>
> Now I think the problem not came from [2.1.38].... :).

There are 2 major sources of locks in 2.1 caused by running out of memory
right now. The patch applied to mm/vmscan.c in 2.1.33 is completely
broken -- kswapd will eat all CPU time when the system runs out of
memory, instead of allowing the next (user) process that askes for a page
to be killed (kswapd has real time priority). Secondly, the new buffer
cache code doesn't seem to be triggering writes quickly enough. Right
now I'm trying to find some sort of clean way of handling low memory
situations.

I think we should add a wait queue for free pages so user processes that
need memory won't eat CPU time while waiting for (slow) disk io to
complete - as it stands now the system will spin in try_to_free_pages
most of the time when we reach the low memory point - Linus/Dave does
this sound like an idea? I'm thinking in get_free_page to try one
call to try_to_free_pages, if that doesn't work, wakeup kswapd & go to
sleep. Even with 64 megs of RAM I can lock the machine fairly easily in
X (it has no swap, but isn't out of memory - it's just not freeing it).
Hopefully a patch on the weekend....

-benjamin