Re: Clearing the I/O caches? (for benchmark tests)

Tom M. Kroeger (tmk@cse.ucsc.edu)
15 Jul 1999 15:55:40 -0700


"Stephen C. Tweedie" <sct@redhat.com> writes:
> On 14 Jul 1999 16:42:47 -0700, tmk@cse.ucsc.edu (Tom M. Kroeger) said:
>
> > In any case the memory exhausting approach still cleared far more
> > space than sys_sync & invalidate_buffers etc... (are these buffers
> > taken from ext2 when memory becomes very low?) Any idea as to why?
>
> Of course it will. Invalidating buffers etc. won't do anything about
> the page cache. A memory flush will also flush out the page cache very
> effectvely.

My apologies, I may have been unclear. I've been trying to clear all
the cache data and have been calling the following: to reduce the

dcache -- prune_dcache(0);

page cache -- empty_dcache(); -- a clone of prune dcache that calls
clear_inode_pages() for each dcache entry
-- and/or a modified shrink_mmap() that
if (xxxx_under_min()) removed and (below)

inode cache -- free_inode_memory(20);

buffer cache -- sys_sync(); & invalidate_all_buffers();

all in an order something like this.

Is there a better way you'd recommend for clearing the cached I/O
data? I suspect the best things seems to be a reboot, and then memory
exhaust will suffice as an approximation despite its side effects.

In any case, sincerely thanks for your patience and help,

-- 

tmk

----------------------------------------------------------------------- Tom M. Kroeger Pray for wind Graduate Student, UC Santa Cruz \ Pray for waves e-mail: tmk@cs.ucsc.edu |\ and Pray it's your day off! http://www.cse.ucsc.edu/~tmk |~\ (831) 459-4458 |__\ (831) 426-9055 home ,----+--

int shrink_mmap_all( void) { struct page * page; int i;

i = max_mapnr; while (i-- > 0) { int referenced; page = mem_map +i; /* This works even in the presence of PageSkip because * the first two entries at the beginning of a hole will * be marked, not just the first. */

if (PageSkip(page)) { continue; } referenced = test_and_clear_bit(PG_referenced, &page->flags);

if (PageLocked(page)) continue;

/* We can't free pages unless there's just one user */ if (atomic_read(&page->count) != 1) continue;

if (PageSwapCache(page)) { if (referenced && swap_count(page->offset) != 1) continue; delete_from_swap_cache(page); continue; }

if (referenced) continue;

/* Is it a buffer page? */ if (page->buffers) { debug(11,"buffer page %d\n",i); free_buffers(page); continue; }

/* is it a page-cache page? */ if (page->inode) { remove_inode_page(page); } } return 0; }

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