Re: [PATCH #2] OOM kill trigger
On Fri, 6 Jul 2001, Jeff Garzik wrote: > Rik van Riel wrote: > > + cache_mem = atomic_read(_cache_size); > > + cache_mem += atomic_read(_pages); > > + cache_mem -= swapper_space.nrpages; > > + limit = (page_cache.min_percent + buffer_mem.min_percent); > > Don't you need extra protection around swapper_space.nrpages? > A barrier right above it? No. It's just a heuristic. Besides, all that could change is the VALUE of swapper_space.nrpages and it won't change by all that much... Rik -- Executive summary of a recent Microsoft press release: "we are concerned about the GNU General Public License (GPL)" http://www.surriel.com/ http://www.conectiva.com/ http://distro.conectiva.com/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH #2] OOM kill trigger
On Fri, 6 Jul 2001, Jeff Garzik wrote: Rik van Riel wrote: + cache_mem = atomic_read(page_cache_size); + cache_mem += atomic_read(buffermem_pages); + cache_mem -= swapper_space.nrpages; + limit = (page_cache.min_percent + buffer_mem.min_percent); Don't you need extra protection around swapper_space.nrpages? A barrier right above it? No. It's just a heuristic. Besides, all that could change is the VALUE of swapper_space.nrpages and it won't change by all that much... Rik -- Executive summary of a recent Microsoft press release: we are concerned about the GNU General Public License (GPL) http://www.surriel.com/ http://www.conectiva.com/ http://distro.conectiva.com/ - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH #2] OOM kill trigger
Rik van Riel wrote: > + cache_mem = atomic_read(_cache_size); > + cache_mem += atomic_read(_pages); > + cache_mem -= swapper_space.nrpages; > + limit = (page_cache.min_percent + buffer_mem.min_percent); Don't you need extra protection around swapper_space.nrpages? A barrier right above it? -- Jeff Garzik | A recent study has shown that too much soup Building 1024| can cause malaise in laboratory mice. MandrakeSoft | - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH #2] OOM kill trigger
Hi, As Hugh pointed out, the info on how many pages we have in the swap cache is (of course) present in the swapper_space structure. Patch has been shrunk accordingly... Rik -- Executive summary of a recent Microsoft press release: "we are concerned about the GNU General Public License (GPL)" http://www.surriel.com/ http://www.conectiva.com/ http://distro.conectiva.com/ --- linux-2.4.6/mm/oom_kill.c.orig Fri Jul 6 17:32:58 2001 +++ linux-2.4.6/mm/oom_kill.c Fri Jul 6 19:19:25 2001 @@ -191,11 +191,28 @@ */ int out_of_memory(void) { + long cache_mem, limit; + /* Enough free memory? Not OOM. */ if (nr_free_pages() > freepages.min) return 0; if (nr_free_pages() + nr_inactive_clean_pages() > freepages.low) + return 0; + + /* +* 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(_cache_size); + cache_mem += atomic_read(_pages); + cache_mem -= swapper_space.nrpages; + limit = (page_cache.min_percent + buffer_mem.min_percent); + limit *= num_physpages / 100; + + if (cache_mem > limit) return 0; /* Enough swap space left? Not OOM. */ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH #2] OOM kill trigger
Hi, As Hugh pointed out, the info on how many pages we have in the swap cache is (of course) present in the swapper_space structure. Patch has been shrunk accordingly... Rik -- Executive summary of a recent Microsoft press release: we are concerned about the GNU General Public License (GPL) http://www.surriel.com/ http://www.conectiva.com/ http://distro.conectiva.com/ --- linux-2.4.6/mm/oom_kill.c.orig Fri Jul 6 17:32:58 2001 +++ linux-2.4.6/mm/oom_kill.c Fri Jul 6 19:19:25 2001 @@ -191,11 +191,28 @@ */ int out_of_memory(void) { + long cache_mem, limit; + /* Enough free memory? Not OOM. */ if (nr_free_pages() freepages.min) return 0; if (nr_free_pages() + nr_inactive_clean_pages() freepages.low) + return 0; + + /* +* 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); + cache_mem += atomic_read(buffermem_pages); + cache_mem -= swapper_space.nrpages; + limit = (page_cache.min_percent + buffer_mem.min_percent); + limit *= num_physpages / 100; + + if (cache_mem limit) return 0; /* Enough swap space left? Not OOM. */ - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH #2] OOM kill trigger
Rik van Riel wrote: + cache_mem = atomic_read(page_cache_size); + cache_mem += atomic_read(buffermem_pages); + cache_mem -= swapper_space.nrpages; + limit = (page_cache.min_percent + buffer_mem.min_percent); Don't you need extra protection around swapper_space.nrpages? A barrier right above it? -- Jeff Garzik | A recent study has shown that too much soup Building 1024| can cause malaise in laboratory mice. MandrakeSoft | - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/