Re: Good way to free as much memory as possible under 2.5.34?

From: Rik van Riel (riel@conectiva.com.br)
Date: Fri Sep 13 2002 - 16:09:55 EST


On Fri, 13 Sep 2002, Pavel Machek wrote:

> /*
> * Try to free as much memory as possible, but do not OOM-kill anyone
> *
> * Notice: all userland should be stopped at this point, or livelock
> is possible.
> */
>
> This worked before -rmap came in, but it does not free anything
> now. What needs to be done to fix it?

Actually, it still worked when -rmap came in, but it stopped working
when the LRU lists were made to be per-zone...

> static void free_some_memory(void)
> {
> printk("Freeing memory: ");
> while
> (try_to_free_pages(&contig_page_data.node_zones[ZONE_HIGHMEM], GFP_KSWAPD, 0))
> printk(".");
> printk("|\n");
> }

Why don't you just allocate memory ?

To prevent the OOM kill you can just check for a variable
in the OOM slow path. No need to rely on any particular
behaviour of the VM.

regards,

Rik

-- 
Bravely reimplemented by the knights who say "NIH".

http://www.surriel.com/ http://distro.conectiva.com/

Spamtraps of the month: september@surriel.com trac@trac.org

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



This archive was generated by hypermail 2b29 : Sun Sep 15 2002 - 22:00:35 EST