View previous topic :: View next topic |
Author |
Message |
eddy89 Apprentice


Joined: 01 Feb 2006 Posts: 180 Location: /world/Italy/Torino
|
Posted: Sat Oct 12, 2013 9:51 am Post subject: Avoiding devices' cache data duplication wasting ram |
|
|
Hi all,
I don't know very well how this works, but as far as I know, block devices have its own block cache and buffers, as long as they are opened, and filesystems have it's own file cache, and some virtual devices (e.g. loop) have their cache too. I wonder if the same data, when I read a file from the filesystem, is cached at least twice in the block cache and in the file cache...
In my case I have some particular configurations where this can become huge and very memory wasting:
-A raspberry pi (256Mb of ram) where the path from physical layer to filesystem is:
mmcblk0p1 (block cache) -> block2mtd (mtd cache?) -> ubi -> ubifs (FS cache) -> files
Another simple example is using loop:
sda (block cache) -> filesystem (file cache) -> loop device (another block cache) -> filesystem (another file cache) -> file
Here we have the same data occupying 4 times the memory it should take, without any benefit.
So, where can I check how much buffer/cache is taking a device in ram?
And where can I disable some of them (/proc? /sys? sysctl?)
Thank you for your help |
|
Back to top |
|
 |
HeissFuss Guru

Joined: 11 Jan 2005 Posts: 414
|
Posted: Tue Oct 29, 2013 6:03 am Post subject: |
|
|
Take a look at slabtop, it may be in there.
I wouldn't expect block device buffers to be very large though, but memory for things like MD devices can be fairly large (compared to 256MB total).
The filesystem buffers would get dropped first if you started hitting memory constraints. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|