On 4/28/05, Tzahi Fadida <[EMAIL PROTECTED]> wrote:
Hi,
I am using the /proc/sys/vm/block_dump
to see reading and writing of blocks for a process.
I am looking at the postgresql database process.
When I run a query for the first time I see a lot of
READs. but the next times I run it, it doesn't show
READs, suggesting the kernel have cahced those blocks
somewhere. Even if I get out of the program and reenters
it doesn't help. I also disabled the swapfile just in case(probably not
related).

>From the little I read about block_dump (in Documentation/laptop-mode.txt)
it appears that this file lists disk access.
The kernel's block cache is not related to any particular process - if one
process causes a block to be read from the disk then any other process
will take advantage of the in-memory copy, regardless if the original process
(it's not just a matter of efficiency but also of consistancy - only one copy should
be authoritative "latest copy" of that block).
The swap partition has nothing to do with this (you guessed correctly) since it
isn't used to hold cached filesystem blocks (the blocks already have a "name"
on the disk - so why bother allocating and maintaining another copy of the same
block also in the swap partition?)

How can I flush this caching?

I'm not aware of any specific kernel trickery to force the flush except maybe
by running a process which allocates a huge amount of memory.

sync(1) ("info coreutils sync") can force syncing of the buffer cache to the disk
but the kernel may still hold and use the in-memory copy after that.

Regards,
        tzahi.

Cheers,

--Amos

Reply via email to