Caching.

From: Rogier Wolff
Date: Fri Aug 06 2004 - 05:07:44 EST



On our server we run:

Linux version 2.4.25-rmap-nonapi (root@obelix) (gcc version 2.95.4
20011002 (Debian prerelease)) #1 SMP Tue Jun 15 13:35:04 CEST 2004

I have this file:

249412 -rw-rw-r-- 2 wolff hdr 1073741824 Aug 5 15:21 disk.img3

which takes some 250Mb on disk, but is 1Gb in size. It's sparse.

When I repeatedly GREP trhough this file, I see large amounts of the
file being reread from disk every time, even though the machine easily
has enough memory to cache the whole 250Mb of diskblocks that the file
compromises.

The server has 1Gb of memory.

To be sure the memory was free, I created a 900Mb application that
would run-and-touch all it's memory. Killing that would leave the
machine with "900Mb free" (actualy just over 908000 kb). Then running
the multiple searches would still page in about half the pages that
should have been cached.

Even when the file on disk only takes about 1Mb of disk space, still
500 of the 1000 kbytes of data on the disk was read every time through
the loop.

My "task at hand" will be done by the time anybody reads this, but
kernel-memory managing could be better, and someone might want to take
a look what's going on.

Roger.

--
** R.E.Wolff@xxxxxxxxxxxx ** http://www.BitWizard.nl/ ** +31-15-2600998 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
**** "Linux is like a wigwam - no windows, no gates, apache inside!" ****
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/