[PATCH] out_of_memory() fix

Rik van Riel (riel@conectiva.com.br)
Mon, 14 May 2001 01:10:47 -0300 (BRST)


Hi Linus,

instead of walking the whole swap bitmap, out_of_memory()
might just as well check the nr_swap_pages variable which
is used by __get_swap_page() ...

regards,

Rik

--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

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

Send all your spam to aardvark@nl.linux.org (spam digging piggy)

--- linux-2.4.5-pre1/mm/oom_kill.c.orig Mon May 14 01:03:33 2001 +++ linux-2.4.5-pre1/mm/oom_kill.c Mon May 14 01:06:56 2001 @@ -191,7 +191,6 @@ */ int out_of_memory(void) { - struct sysinfo swp_info; /* Enough free memory? Not OOM. */ if (nr_free_pages() > freepages.min) @@ -201,8 +200,7 @@ return 0; /* Enough swap space left? Not OOM. */ - si_swapinfo(&swp_info); - if (swp_info.freeswap > 0) + if (nr_swap_pages > 0) return 0; /* Else... */

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