Messages in this thread Patch in this message |  | | Date | Tue, 30 Oct 2001 08:52:58 -0800 (PST) | From | Linus Torvalds <> | Subject | Re: need help interpreting 'free' output. |
| |
On Tue, 30 Oct 2001, Hugh Dickins wrote: > > However, unlike 2.4.13, 2.4.14-pre (you tried pre4, I just tried pre5) > seems much too unwilling to shrink_dcache and shrink_icache: your > memory hog should shrink them, but it seems not to. Linus?
Yes. It's next on my list.
My _preferred_ approach would actually be to move the slab pages to the LRU list too, and have a special "slab" address space (we don't need to actually hash them, we just make page->mapping point to it), and have the cache shrink be done naturally as part of writepage().
That way "shrink_cache()" reacts very naturally to slab pressure, while right now it's more of a random behaviour. That's what the "anonymous pages in the LRU" approach fixes - the VM scanning reacts very naturally (instead of with subtle tweaking and almost random behaviour) to mapped page pressure.
The "slab address space" is a longer-range plan, though. It migth be really simple (the writepage would just move the page to the active list and try to shrink the slab that was hit), but I think the current stuff is "good enough".
So in the short range, I haven't come up with any really good approaches, but I suspect I'll just have to move the shrink_[di]cache() back to the caller, which will at least shrink them on swapouts (a bit too much, I think, but on the other hand maybe not).
Patch attached,
Linus diff -u --recursive pre5/linux/mm/vmscan.c linux/mm/vmscan.c --- pre5/linux/mm/vmscan.c Tue Oct 30 08:51:13 2001 +++ linux/mm/vmscan.c Tue Oct 30 08:46:08 2001 @@ -515,20 +515,6 @@ } spin_unlock(&pagemap_lru_lock); - if (nr_pages <= 0) - return 0; - - /* - * If swapping out isn't appropriate, and - * we still fail, try the other (usually smaller) - * caches instead. - */ - shrink_dcache_memory(priority, gfp_mask); - shrink_icache_memory(priority, gfp_mask); -#ifdef CONFIG_QUOTA - shrink_dqcache_memory(DEF_PRIORITY, gfp_mask); -#endif - return nr_pages; } @@ -577,7 +563,17 @@ ratio = (unsigned long) nr_pages * nr_active_pages / ((nr_inactive_pages + 1) * 2); refill_inactive(ratio); - return shrink_cache(nr_pages, classzone, gfp_mask, priority); + nr_pages = shrink_cache(nr_pages, classzone, gfp_mask, priority); + if (nr_pages <= 0) + return 0; + + shrink_dcache_memory(priority, gfp_mask); + shrink_icache_memory(priority, gfp_mask); +#ifdef CONFIG_QUOTA + shrink_dqcache_memory(DEF_PRIORITY, gfp_mask); +#endif + + return nr_pages; } int try_to_free_pages(zone_t *classzone, unsigned int gfp_mask, unsigned int order)
|  |