[lkml]   [1999]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Clearing the I/O caches? (for benchmark tests)
"Stephen C. Tweedie" <> writes:
> On 14 Jul 1999 16:42:47 -0700, (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,



Tom M. Kroeger Pray for wind
Graduate Student, UC Santa Cruz \ Pray for waves
e-mail: |\ and Pray it's your day off! |~\
(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)) {

referenced = test_and_clear_bit(PG_referenced, &page->flags);

if (PageLocked(page))

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

if (PageSwapCache(page)) {
if (referenced && swap_count(page->offset) != 1)

if (referenced)

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

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

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:53    [W:0.054 / U:0.012 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site