Forum Discussion
Altera_Forum
Honored Contributor
21 years agoµCLinux - How to minimize buffers
Hello, im trying to minimize the buffers used by Linux to gain more free memory. My custom board is equipped with a 2MB SDRAM chip, but after booting the kernel I have only between 200-300 KB free. I heard wentao talking about the kernel dynamically allocating a lot of RAM during the boot process - does this include buffers .....and is there a way to decrease the size of these buffers?
When I use the "free"-command on my development board (Altera Nios Cyclone) after booting up Linux, it says:MemTotal: 14776 kB
MemFree: 11720 kB
Buffers: 1208 kB Here the buffers take up 1208 KB which is OK because the dev. board got plenty of ram....but if it also takes up over 1MB of RAM on my custom board that too much. I can't use the "free"-command on my custom board because - I believe - "free" requires /proc which in turn requires a RAM-drive which requires "mount" to be called .....and I don't have enough free ram to execute "mount" ......so thats just perfect http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/huh.gif If anyone has any ideas I would be glad to hear them! Currently im also trying to make the kernel execute in place .....but im still having a bit trouble with that even thou wentao pointed me in the right direction. Hope you guys can help me Regards Goon2 Replies
- Altera_Forum
Honored Contributor
Hello, I guess it wasn't the buffers that consumed all my memory after all. When I use the command:
I get the following result:cat meminfo
It seems that it is the Slab allocator that eats most of my memory, but how can I minimize its consumption? And what exactly DOES this Slab-allocator actually do? Hope anybody can help me. By the way I removed the RAM-drive in the kernel-setup - so now i write: <div class='quotetop'>QUOTE </div> --- Quote Start --- mount -t ramfs ramfs /var -n[/b] --- Quote End --- instead of: <div class='quotetop'>QUOTE </div> --- Quote Start --- mount -t ext2 /dev/ram0 /var -n[/b] --- Quote End --- Regards Goon# cat meminfo MemTotal: 1220 kB MemFree: 380 kB Buffers: 148 kB Cached: 56 kB SwapCached: 0 kB Active: 136 kB Inactive: 60 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 1220 kB LowFree: 380 kB SwapTotal: 0 kB SwapFree: 0 kB Dirty: 0 kB Writeback: 0 kB Mapped: 0 kB Slab: 512 kB Committed_AS: 0 kB PageTables: 0 kB VmallocTotal: 4194303 kB VmallocUsed: 0 kB VmallocChunk: 4194303 kB - Altera_Forum
Honored Contributor
Hi Goon,
The slab layer manages the small data structures frequently allocated and freed by kernel. For example, process descriptors, inodes, etc are all from it. Since kernel needs allocate all kinds of structures in order to run, and will automatically try to free memory from it when system available memory is low, I don't think you can squeeze much from the 512K. Regards, wentao