Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Kernel v2.4.13-ac8 /mm/oom_kill.c

Filename:/mm/oom_kill.c
Lines Added:10
Lines Deleted:31
Also changed in: (Previous) 2.4.13-ac7  2.4.13-ac6  2.4.13-ac5  2.4.13-ac4  2.4.13-ac3  2.4.13-ac1 
(Following) 2.4.14  2.4.18-pre3-ac1  2.4.18-pre3-ac2  2.4.18-pre7-ac1  2.4.18-pre7-ac2  2.4.18-pre7-ac3 

Location
[  2.4.13-ac8
  [  mm
     o  oom_kill.c

Patch

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla/mm/oom_kill.c linux.ac/mm/oom_kill.c
--- linux.vanilla/mm/oom_kill.c   Thu Oct 11 13:52:14 2001
+++ linux.ac/mm/oom_kill.c   Wed Oct 10 01:48:38 2001
@@ -193,34 +193,7 @@
    return;
 }
 
-static inline int node_zones_low(pg_data_t *pgdat)
-{
-   zone_t * zone;
-   int i;
-
-   for (i = pgdat->nr_zones-1; i >= 0; i--) {
-      zone = pgdat->node_zones + i;
-
-      if (zone->free_pages > (zone->pages_low))
-         return 0;
-
-   }
-   return 1;
-}
-
-static int all_zones_low(void)
-{
-   pg_data_t * pgdat = pgdat_list;
-
-   pgdat = pgdat_list;
-   do {
-      if (node_zones_low(pgdat))
-         continue;
-      return 0;
-   } while ((pgdat = pgdat->node_next));
-
-   return 1;
-}
+extern long count_ramdisk_pages(void);
 
 /**
  * out_of_memory - is the system out of memory?
@@ -233,7 +206,10 @@
    long cache_mem, limit;
 
    /* Enough free memory?  Not OOM. */
-   if (!all_zones_low())
+   if (nr_free_pages() > freepages.min)
+      return 0;
+
+   if (nr_free_pages() + nr_inactive_clean_pages() > freepages.low)
       return 0;
 
    /* Enough swap space left?  Not OOM. */
@@ -241,13 +217,16 @@
       return 0;
 
    /*
-    * If the buffer and page cache (including swap cache) are over
+    * If the buffer and page cache (excluding swap cache) are over
     * their (/proc tunable) minimum, we're still not OOM.  We test
     * this to make sure we don't return OOM when the system simply
     * has a hard time with the cache.
     */
    cache_mem = atomic_read(&page_cache_size);
-   limit = 2;
+   cache_mem += atomic_read(&buffermem_pages);
+   cache_mem -= swapper_space.nrpages;
+   cache_mem -= count_ramdisk_pages();
+   limit = (page_cache.min_percent + buffer_mem.min_percent);
    limit *= num_physpages / 100;
 
    if (cache_mem > limit)


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.