Re: Fix (sort of) for OOM swap deadlock.

Rik van Riel (H.H.vanRiel@phys.uu.nl)
Mon, 22 Jun 1998 10:36:31 +0200 (CEST)


On Mon, 22 Jun 1998, George wrote:

> Of course, I have no idea if this has a race since I'm not an experienced
> kernel hacker, but "it works for me."

> diff -upr 2.1.106/linux/mm/vmscan.c linux/mm/vmscan.c
> --- 2.1.106/linux/mm/vmscan.c Mon Jun 22 00:01:49 1998
> +++ linux/mm/vmscan.c Sun Jun 21 23:58:53 1998
[snip]
> @@ -564,6 +586,13 @@ int kswapd(void *unused)
> * woken up more often and the rate will be even
> * higher).
> */
> + if (out_of_swap()) {

You might want to change this to:
if (out_of_swap() && (num_physpages * (buffer_mem.min_percent
+ page_cache.min_percent) > ((buffermem >> PAGE_SHIFT) +
page_cache_size) * 91)) {
oom_kill();

This will call the OOM killer (which can be found on my
Linux patches page) when the swap area is full and cache
+ buffer memory are at less than 110% of their minimum...

This would seem like a decent approximation of thrashing,
besides, we can always change it later when it appears that
this isn't working...

I'm rather busy with the kernel and the Linux-MM homepage
at the moment, so I'd appreciate it if you would make a patch
out of our code... [and if you would include the oom_kill.c
file from my homepage].

> +#ifdef DEBUG
> + printk("kswapd: No swap left, not paging.\n");
> +#endif
> + continue;

s/continue/oom_kill()/

> + }
> +
> tries = pager_daemon.tries_base >> free_memory_available(3);

TIA,

Rik.
+-------------------------------------------------------------------+
| Linux memory management tour guide. H.H.vanRiel@phys.uu.nl |
| Scouting Vries cubscout leader. http://www.phys.uu.nl/~riel/ |
+-------------------------------------------------------------------+

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu