Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Avoiding devices' cache data duplication wasting ram
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
eddy89
Apprentice
Apprentice


Joined: 01 Feb 2006
Posts: 173
Location: /world/Italy/Torino

PostPosted: Sat Oct 12, 2013 9:51 am    Post subject: Avoiding devices' cache data duplication wasting ram Reply with quote

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
View user's profile Send private message
HeissFuss
Guru
Guru


Joined: 11 Jan 2005
Posts: 406

PostPosted: Tue Oct 29, 2013 6:03 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
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