Skip to contentSkip to conversation

Reduce Linux memory requirements for an Embedded PC

DISCUSSION Petr Dusil 6 participants 7 messages Mar 24, 2001 Memory management

lore
Share & tools
lore

Petr Dusil

author
#0 lore raw

Hello All,

I am developing a Linux distribution for a Jumptec Embedded PC. It is targeted to an I486, 16MB DRAM, 16MB DiskOnChip. I have decided to use Redhat 6.2 (2.2.14 kernel) and to reduce its size to fit the EPC. I have simplified the kernel (removed support of all unwanted hardware), init scripts and amount of apps I will really need. I do not have problems with its size on disk (8MB), but I do see a problem in its memory requirements. It takes now about 11MB. It is too much. I tried to replace init by sulogin to get bash shell and look into the system memory as soon as possible, but again without starting any daemon only with bash running I got 7MB. I am asking you, is there any option to tell Linux kernel "save the memory" or what are the general recommendations to minimize amount of memory the kernel consumes?

Thank you very much for an answer,

Petr

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

#1 lore raw
Quoted 14 lines · Petr Dusil

Hello All,

I am developing a Linux distribution for a Jumptec Embedded PC. It is targeted to an I486, 16MB DRAM, 16MB DiskOnChip. I have decided to use Redhat 6.2 (2.2.14 kernel) and to reduce its size to fit the EPC. I have simplified the kernel (removed support of all unwanted hardware), init scripts and amount of apps I will really need. I do not have problems with its size on disk (8MB), but I do see a problem in its memory requirements. It takes now about 11MB. It is too much. I tried to replace init by sulogin to get bash shell and look into the system memory as soon as possible, but again without starting any daemon only with bash running I got 7MB. I am asking you, is there any option to tell Linux kernel "save the memory" or what are the general recommendations to minimize amount of memory the kernel consumes?

One way is to go back to a 2.0 kernel, which uses somewhat less memory. I did that on a 4MB box. There are also ways to reduce memory usage further for both 2.0 and 2.2, but it requires a bit of source patching. Basically you go through nm --size-sort -t d vmlinux and try to reduce all big symbols, like the static super block array and reducing sizes of preallocated hash tables (e.g. buffer and networking hash is very big in 2.2)
There are other ways, e.g. with some patching the memory usage of a select() using program can be significantly reduced. Easiest way is probably to try 2.0 first.

-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

#6 lore raw
In reply to Petr Dusil

Hi,

Quoted 5 lines · Petr Dusil

memory as soon as possible, but again without starting any daemon only with bash running I got 7MB. I am asking you, is there any option to tell Linux kernel "save the memory" or what are the general recommendations to minimize amount of memory the kernel consumes?

First of all, bash and glibc are both fairly large chunks of code. There are much smaller shells available, and there is at least one miniature libc intended for embedded use.

Secondly, how are you booting the fs? ramdisks (including initrd) are fairly wasteful of memory if used as a root filesystem; ramfs for writable data and cramfs for a static boot fs are much better choices.

Cheers,
Stephen
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

#2 lore raw
In reply to Andi Kleen
Quoted 7 lines · Andi Kleen
Quoted 4 lines · Petr Dusil

I am developing a Linux distribution for a Jumptec Embedded PC. It is targeted to an I486, 16MB DRAM, 16MB DiskOnChip. I have decided to use Redhat 6.2 (2.2.14 kernel) and to reduce its size to fit the EPC. I have simplified the kernel (removed support of all unwanted hardware),

Quoted 7 lines

One way is to go back to a 2.0 kernel, which uses somewhat less memory. I did that on a 4MB box. There are also ways to reduce memory usage further for both 2.0 and 2.2, but it requires a bit of source patching. Basically you go through nm --size-sort -t d vmlinux and try to reduce all big symbols, like the static super block array and reducing sizes of preallocated hash tables (e.g. buffer and networking hash is very big in 2.2)

I'm willing to work on a CONFIG_TINY option for 2.5 which does things like this (but I'll have to finish some VM things first ;)).

regards,

Rik
--
Virtual memory is like a game you can't win; However, without VM there's truly nothing to lose...

		http://www.surriel.com/

http://www.conectiva.com/ http://distro.conectiva.com.br/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

#3 lore raw
Quoted 3 lines · Rik van Riel

I'm willing to work on a CONFIG_TINY option for 2.5 which does things like this (but I'll have to finish some VM things first ;)).

Why not 2.4? It is only a configuration thing, right? People are using Linux more and more for embedded stuff. So waiting 2 years more is not an option.

I'm willing to help, if we collect some ideas on WHAT to do first.

I had problems even on 64MB with no swap attached, so this is a serious problem (look at comment on OOM killer does not trigger).

Esp. in the network layer we need to reduce memory usage, since this triggered it for me on this oversized box.

Also a set of configs (may be sysctl stuff) to adjust trade-off decisions on throughput vs. latency or memory vs. speed and the like.

Autotuning is nice, but has always the chance to fail for corner cases. Taking these into account to generates too much code bloat. So making the required tunables available (as already happend with threads-max, file-max and the like) is supporting the idea of 'providing features, not policy'.

Regards

Ingo Oeser

Signature · 6 lines
10.+11.03.2001 - 3. Chemnitzer LinuxTag <http://www.tu-chemnitz.de/linux/tag>
         <<<<<<<<<<<<     been there and had much fun   >>>>>>>>>>>>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
#5 lore raw
In reply to Rik van Riel
Quoted 4 lines · Rik van Riel

I'm willing to work on a CONFIG_TINY option for 2.5 which does things like this (but I'll have to finish some VM things first ;)).

That could be hard, because the amount of tinyness which can be forced on the VM versus, say, IPV4 will vary from application to application.

I think this is best solved with documentation, frankly.

Just itemise where the large memory-consumers are, how much they can be reduced, how to reduce them and what the consequences of this are.

There's quite a bit of stuff out there - just google for "linux embedded memory requirements reduce". It's a matter of pulling it all together.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

#4 lore raw
In reply to Ingo Oeser
Quoted 8 lines · Ingo Oeser
Quoted 3 lines · Rik van Riel

I'm willing to work on a CONFIG_TINY option for 2.5 which does things like this (but I'll have to finish some VM things first ;)).

Why not 2.4? It is only a configuration thing, right? People are using Linux more and more for embedded stuff. So waiting 2 years more is not an option.

It depends. I definately want to start development on 2.4 and keep some patch around. If things turn out to be trivial we can submit the patch for 2.4, if not we can keep the patch separately.

Quoted 2 lines

I'm willing to help, if we collect some ideas on WHAT to do first.

- write a script to move all extern inline functions to a C file and have them compile out-of-line
- drastically reduce (or even abolish) hash tables for buffer cache, page cache, network routing, sockets, ... [ if you have 20 items, you may as well walk a list ]
- compile out all kinds of code which make optimisations that only work for larger machines (dynamic readahead size reduction, ...)

Quoted 5 lines

Autotuning is nice, but has always the chance to fail for corner cases. Taking these into account to generates too much code bloat. So making the required tunables available (as already happend with threads-max, file-max and the like) is supporting the idea of 'providing features, not policy'.

*nod*

regards,

Rik
--
Virtual memory is like a game you can't win; However, without VM there's truly nothing to lose...

		http://www.surriel.com/

http://www.conectiva.com/ http://distro.conectiva.com.br/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/