| Kernel v2.4.13-ac8 /mm/oom_kill.c |
|---|
 2.4.13-ac8
 mm
 oom_kill.c
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)
|