linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] oom-killer trigger
@ 2001-03-01 22:31 Rik van Riel
  2001-03-01 22:51 ` David Mansfield
  0 siblings, 1 reply; 2+ messages in thread
From: Rik van Riel @ 2001-03-01 22:31 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-mm, XosÉ Vázquez, linux-kernel

Hi,

the OOM killer in Linux 2.4 has a rather embarrasing bug.

1. the OOM killer never triggers if we have > freepages.min
   of free memory
2. __alloc_pages() never allocates pages to < freepages.min
   for user allocations

==> the OOM killer never gets triggered under some workloads;
    the system just sits around with nr_free_pages == freepages.min

The patch below trivially fixes this by upping the OOM kill limit
by a really small number of pages ...

Now lets hope it won't trigger too early (but since it'll only
trigger when we're completely out of swap, etc...).

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://www.conectiva.com/	http://distro.conectiva.com/


--- mm/oom_kill.c.orig	Thu Mar  1 18:57:11 2001
+++ mm/oom_kill.c	Thu Mar  1 18:58:23 2001
@@ -188,13 +188,17 @@
  *
  * Returns 0 if there is still enough memory left,
  * 1 when we are out of memory (otherwise).
+ *
+ * Note that since __alloc_pages() never lets user
+ * allocations go below freepages.min, we have to
+ * use a slightly higher threshold here...
  */
 int out_of_memory(void)
 {
 	struct sysinfo swp_info;

 	/* Enough free memory?  Not OOM. */
-	if (nr_free_pages() > freepages.min)
+	if (nr_free_pages() > freepages.min + 4)
 		return 0;

 	if (nr_free_pages() + nr_inactive_clean_pages() > freepages.low)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] oom-killer trigger
  2001-03-01 22:31 [PATCH] oom-killer trigger Rik van Riel
@ 2001-03-01 22:51 ` David Mansfield
  0 siblings, 0 replies; 2+ messages in thread
From: David Mansfield @ 2001-03-01 22:51 UTC (permalink / raw)
  To: Rik van Riel; +Cc: Alan Cox, linux-mm, XosÉ Vázquez, linux-kernel

> 
> 1. the OOM killer never triggers if we have > freepages.min
>    of free memory
> 2. __alloc_pages() never allocates pages to < freepages.min
>    for user allocations
> 
> ==> the OOM killer never gets triggered under some workloads;
>     the system just sits around with nr_free_pages == freepages.min
> 
> The patch below trivially fixes this by upping the OOM kill limit
> by a really small number of pages ...

> +       if (nr_free_pages() > freepages.min + 4)


Call me stupid, but why not just change the > to >= (or < to <=) rather
than introducing a magic number (4).  Or at least make the magic number
interesting, like:

+       if (nr_free_pages() > freepages.min + 42)

:-)

Thanks for the bugfix,
David

-- 
David Mansfield                                           (718) 963-2020
david@ultramaster.com
Ultramaster Group, LLC                               www.ultramaster.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-03-01 22:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-01 22:31 [PATCH] oom-killer trigger Rik van Riel
2001-03-01 22:51 ` David Mansfield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox