[PATCH] inode & dentry cache balancing

Rik van Riel (riel@conectiva.com.br)
Wed, 23 May 2001 14:44:48 -0300 (BRST)


Hi,

the following patch simplifies the if-else conditions in
do_try_to_free_pages() to the extent where it actually
balances the normal pages against the inode & dentry caches
again.

Note that the strange if-else around kmem_cache_reap() isn't
needed either, since page_launder() will, in the first loop,
free the buffer heads that are needed for the second loop and
for shrink_{icache,dcache}_memory() ... and if it doesn't we
still have enough IO outstanding to keep the IO subsystem busy
so it shouldn't matter either.

Please apply for the next -pre or -ac kernel...

regards,

Rik

--
Linux MM bugzilla: http://linux-mm.org/bugzilla.shtml

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/

--- linux-2.4.5-pre3/mm/vmscan.c.orig Wed May 23 14:09:23 2001 +++ linux-2.4.5-pre3/mm/vmscan.c Wed May 23 14:19:32 2001 @@ -865,14 +865,18 @@

/* * If we're low on free pages, move pages from the - * inactive_dirty list to the inactive_clean list. + * inactive_dirty list to the inactive_clean list + * and shrink the inode and dentry caches. * * Usually bdflush will have pre-cleaned the pages * before we get around to moving them to the other * list, so this is a relatively cheap operation. */ - if (free_shortage()) + if (free_shortage()) { ret += page_launder(gfp_mask, user); + shrink_dcache_memory(DEF_PRIORITY, gfp_mask); + shrink_icache_memory(DEF_PRIORITY, gfp_mask); + }

/* * If needed, we move pages from the active list @@ -882,21 +886,10 @@ ret += refill_inactive(gfp_mask, user);

/* - * Delete pages from the inode and dentry caches and - * reclaim unused slab cache if memory is low. + * If we're still short on free pages, reclaim unused + * slab cache memory. */ if (free_shortage()) { - shrink_dcache_memory(DEF_PRIORITY, gfp_mask); - shrink_icache_memory(DEF_PRIORITY, gfp_mask); - } else { - /* - * Illogical, but true. At least for now. - * - * If we're _not_ under shortage any more, we - * reap the caches. Why? Because a noticeable - * part of the caches are the buffer-heads, - * which we'll want to keep if under shortage. - */ kmem_cache_reap(gfp_mask); }

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/