public inbox for gentoo-embedded@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-embedded] Small standard system take 84MB of ram after startup. How to lower memory footprint?
@ 2013-01-16 20:46 Kfir Lavi
  2013-01-16 21:05 ` Mike Frysinger
  0 siblings, 1 reply; 10+ messages in thread
From: Kfir Lavi @ 2013-01-16 20:46 UTC (permalink / raw
  To: gentoo-embedded

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

Hi,
I have created a small Gentoo system. It is based on glibc.
When it starts, I see use of 84MB and free is 33MB.
Using 'free -m' command.
How can I debug this issue, in order to lower the memory footprint?

Thanks,
Kfir

[-- Attachment #2: Type: text/html, Size: 281 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-embedded] Small standard system take 84MB of ram after startup. How to lower memory footprint?
  2013-01-16 20:46 [gentoo-embedded] Small standard system take 84MB of ram after startup. How to lower memory footprint? Kfir Lavi
@ 2013-01-16 21:05 ` Mike Frysinger
  2013-01-17  4:20   ` Kfir Lavi
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Frysinger @ 2013-01-16 21:05 UTC (permalink / raw
  To: gentoo-embedded

[-- Attachment #1: Type: Text/Plain, Size: 323 bytes --]

On Wednesday 16 January 2013 15:46:11 Kfir Lavi wrote:
> I have created a small Gentoo system. It is based on glibc.
> When it starts, I see use of 84MB and free is 33MB.
> Using 'free -m' command.
> How can I debug this issue, in order to lower the memory footprint?

run `ps aux`.  find & kill all unused services.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-embedded] Small standard system take 84MB of ram after startup. How to lower memory footprint?
  2013-01-16 21:05 ` Mike Frysinger
@ 2013-01-17  4:20   ` Kfir Lavi
  2013-01-17  9:25     ` Markos Chandras
  0 siblings, 1 reply; 10+ messages in thread
From: Kfir Lavi @ 2013-01-17  4:20 UTC (permalink / raw
  To: gentoo-embedded

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

On Wed, Jan 16, 2013 at 11:05 PM, Mike Frysinger <vapier@gentoo.org> wrote:

> On Wednesday 16 January 2013 15:46:11 Kfir Lavi wrote:
> > I have created a small Gentoo system. It is based on glibc.
> > When it starts, I see use of 84MB and free is 33MB.
> > Using 'free -m' command.
> > How can I debug this issue, in order to lower the memory footprint?
>
> run `ps aux`.  find & kill all unused services.
> -mike
>
I don't have much of un essential services. Just agetty. But its not much.
What I'm asking, is there a compilation way to reduce footprint?
I used here -O2. I'll need to check with -Os to see difference.
It seems to me that it takes too much memory for small system like this.

Kfir

[-- Attachment #2: Type: text/html, Size: 1159 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-embedded] Small standard system take 84MB of ram after startup. How to lower memory footprint?
  2013-01-17  4:20   ` Kfir Lavi
@ 2013-01-17  9:25     ` Markos Chandras
  2013-01-17 10:43       ` Kfir Lavi
  0 siblings, 1 reply; 10+ messages in thread
From: Markos Chandras @ 2013-01-17  9:25 UTC (permalink / raw
  To: gentoo-embedded

On 17 January 2013 04:20, Kfir Lavi <lavi.kfir@gmail.com> wrote:
>
>
> On Wed, Jan 16, 2013 at 11:05 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>>
>> On Wednesday 16 January 2013 15:46:11 Kfir Lavi wrote:
>> > I have created a small Gentoo system. It is based on glibc.
>> > When it starts, I see use of 84MB and free is 33MB.
>> > Using 'free -m' command.
>> > How can I debug this issue, in order to lower the memory footprint?
>>
>> run `ps aux`.  find & kill all unused services.
>> -mike
>
> I don't have much of un essential services. Just agetty. But its not much.
> What I'm asking, is there a compilation way to reduce footprint?
> I used here -O2. I'll need to check with -Os to see difference.
> It seems to me that it takes too much memory for small system like this.
>
> Kfir
>

-Os is preferred for low memory systems.

-- 
Regards,
Markos Chandras / Gentoo Linux Developer / Key ID: B4AFF2C2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-embedded] Small standard system take 84MB of ram after startup. How to lower memory footprint?
  2013-01-17  9:25     ` Markos Chandras
@ 2013-01-17 10:43       ` Kfir Lavi
  2013-01-17 10:46         ` Kfir Lavi
                           ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Kfir Lavi @ 2013-01-17 10:43 UTC (permalink / raw
  To: gentoo-embedded

[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]

On Thu, Jan 17, 2013 at 11:25 AM, Markos Chandras <hwoarang@gentoo.org>wrote:

> On 17 January 2013 04:20, Kfir Lavi <lavi.kfir@gmail.com> wrote:
> >
> >
> > On Wed, Jan 16, 2013 at 11:05 PM, Mike Frysinger <vapier@gentoo.org>
> wrote:
> >>
> >> On Wednesday 16 January 2013 15:46:11 Kfir Lavi wrote:
> >> > I have created a small Gentoo system. It is based on glibc.
> >> > When it starts, I see use of 84MB and free is 33MB.
> >> > Using 'free -m' command.
> >> > How can I debug this issue, in order to lower the memory footprint?
> >>
> >> run `ps aux`.  find & kill all unused services.
> >> -mike
> >
> > I don't have much of un essential services. Just agetty. But its not
> much.
> > What I'm asking, is there a compilation way to reduce footprint?
> > I used here -O2. I'll need to check with -Os to see difference.
> > It seems to me that it takes too much memory for small system like this.
> >
> > Kfir
> >
>
> -Os is preferred for low memory systems.
>
> --
> Regards,
> Markos Chandras / Gentoo Linux Developer / Key ID: B4AFF2C2
>
>
I just killed some processes and arrived to bare system 64MB.
Now just sshd, bash and agetty are showing in ps aux as real processes.
The other are kernel processes.
The kernel is pretty lean. Should I expect 64MB as the initial system
memory use?
Can I lower it?

Thanks,
Kfir

[-- Attachment #2: Type: text/html, Size: 2033 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-embedded] Small standard system take 84MB of ram after startup. How to lower memory footprint?
  2013-01-17 10:43       ` Kfir Lavi
@ 2013-01-17 10:46         ` Kfir Lavi
  2013-01-18 15:19         ` Christian Bricart
  2013-01-18 19:37         ` Mike Frysinger
  2 siblings, 0 replies; 10+ messages in thread
From: Kfir Lavi @ 2013-01-17 10:46 UTC (permalink / raw
  To: gentoo-embedded

[-- Attachment #1: Type: text/plain, Size: 1547 bytes --]

On Thu, Jan 17, 2013 at 12:43 PM, Kfir Lavi <lavi.kfir@gmail.com> wrote:

>
>
> On Thu, Jan 17, 2013 at 11:25 AM, Markos Chandras <hwoarang@gentoo.org>wrote:
>
>> On 17 January 2013 04:20, Kfir Lavi <lavi.kfir@gmail.com> wrote:
>> >
>> >
>> > On Wed, Jan 16, 2013 at 11:05 PM, Mike Frysinger <vapier@gentoo.org>
>> wrote:
>> >>
>> >> On Wednesday 16 January 2013 15:46:11 Kfir Lavi wrote:
>> >> > I have created a small Gentoo system. It is based on glibc.
>> >> > When it starts, I see use of 84MB and free is 33MB.
>> >> > Using 'free -m' command.
>> >> > How can I debug this issue, in order to lower the memory footprint?
>> >>
>> >> run `ps aux`.  find & kill all unused services.
>> >> -mike
>> >
>> > I don't have much of un essential services. Just agetty. But its not
>> much.
>> > What I'm asking, is there a compilation way to reduce footprint?
>> > I used here -O2. I'll need to check with -Os to see difference.
>> > It seems to me that it takes too much memory for small system like this.
>> >
>> > Kfir
>> >
>>
>> -Os is preferred for low memory systems.
>>
>> --
>> Regards,
>> Markos Chandras / Gentoo Linux Developer / Key ID: B4AFF2C2
>>
>>
> I just killed some processes and arrived to bare system 64MB.
> Now just sshd, bash and agetty are showing in ps aux as real processes.
> The other are kernel processes.
> The kernel is pretty lean. Should I expect 64MB as the initial system
> memory use?
> Can I lower it?
>
> Thanks,
> Kfir
>

Oh, just to note:
I'm using -minimal USE flag on this system, and get about 50 packages.

[-- Attachment #2: Type: text/html, Size: 2515 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-embedded] Small standard system take 84MB of ram after startup. How to lower memory footprint?
  2013-01-17 10:43       ` Kfir Lavi
  2013-01-17 10:46         ` Kfir Lavi
@ 2013-01-18 15:19         ` Christian Bricart
  2013-01-18 19:37         ` Mike Frysinger
  2 siblings, 0 replies; 10+ messages in thread
From: Christian Bricart @ 2013-01-18 15:19 UTC (permalink / raw
  To: gentoo-embedded

Kfir Lavi wrote:
> On Thu, Jan 17, 2013 at 11:25 AM, Markos Chandras
> <hwoarang@gentoo.org>wrote:
>
>> On 17 January 2013 04:20, Kfir Lavi <lavi.kfir@gmail.com> wrote:
>> >
>> >
>> > On Wed, Jan 16, 2013 at 11:05 PM, Mike Frysinger <vapier@gentoo.org>
>> wrote:
>> >>
>> >> On Wednesday 16 January 2013 15:46:11 Kfir Lavi wrote:
>> >> > I have created a small Gentoo system. It is based on glibc.
>> >> > When it starts, I see use of 84MB and free is 33MB.
>> >> > Using 'free -m' command.
>> >> > How can I debug this issue, in order to lower the memory footprint?
>> >>
>> >> run `ps aux`.  find & kill all unused services.
>> >> -mike
>> >
>> > I don't have much of un essential services. Just agetty. But its not
>> much.
>> > What I'm asking, is there a compilation way to reduce footprint?
>> > I used here -O2. I'll need to check with -Os to see difference.
>> > It seems to me that it takes too much memory for small system like
>> this.
>> >
>> > Kfir
>> >
>>
>> -Os is preferred for low memory systems.
>>
>> --
>> Regards,
>> Markos Chandras / Gentoo Linux Developer / Key ID: B4AFF2C2
>>
>>
> I just killed some processes and arrived to bare system 64MB.
> Now just sshd, bash and agetty are showing in ps aux as real processes.
> The other are kernel processes.
> The kernel is pretty lean. Should I expect 64MB as the initial system
> memory use?
> Can I lower it?

s/sshd/dropbear ?
s/bash/someothersh/ - maybe just ash from busybox..?
..
s/glibc/uclibc/ ?

Christian







^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-embedded] Small standard system take 84MB of ram after startup. How to lower memory footprint?
  2013-01-17 10:43       ` Kfir Lavi
  2013-01-17 10:46         ` Kfir Lavi
  2013-01-18 15:19         ` Christian Bricart
@ 2013-01-18 19:37         ` Mike Frysinger
  2013-01-21 11:32           ` Bertrand Jacquin
  2 siblings, 1 reply; 10+ messages in thread
From: Mike Frysinger @ 2013-01-18 19:37 UTC (permalink / raw
  To: gentoo-embedded

[-- Attachment #1: Type: Text/Plain, Size: 1263 bytes --]

On Thursday 17 January 2013 05:43:09 Kfir Lavi wrote:
> I just killed some processes and arrived to bare system 64MB.
> Now just sshd, bash and agetty are showing in ps aux as real processes.
> The other are kernel processes.
> The kernel is pretty lean. Should I expect 64MB as the initial system
> memory use?
> Can I lower it?

you have to look at where exactly memory is being used

when the kernel boots, it very clearly tells you what it is using as a 
starting point.  in dmesg, look for the line starting with "Available:".

from there, run `ps auxOR`.  the VSZ/RSS fields will tell you how much memory 
each process is using (be aware that some of it is shared e.g. glibc shared 
libs).

then look at /proc/meminfo and see what is being used where.

i'm assuming your system is booting off a real rootfs (e.g. not an initramfs) 
so usage there shouldn't be a big problem.

with that information, you can see what can be shrunk or what is unavoidable.

FWIW, i built Blackfin systems w/16MiB of RAM fairly easily.  but those used 
uClibc and busybox (and dropbear for ssh).  while much of userland was built 
with -Os, the kernel and uClibc were built with -O2 as the space/optimization 
tradeoffs didn't seem worth it.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-embedded] Small standard system take 84MB of ram after  startup. How to lower memory footprint?
  2013-01-18 19:37         ` Mike Frysinger
@ 2013-01-21 11:32           ` Bertrand Jacquin
  2013-01-22 12:53             ` Peter Stuge
  0 siblings, 1 reply; 10+ messages in thread
From: Bertrand Jacquin @ 2013-01-21 11:32 UTC (permalink / raw
  To: gentoo-embedded

Hi,

I think I should take some times to document and public the things I 
wrote on my spare time for embedded devices.

I used to create firmwares for network devices for PCengines Alix, 
Fonera, ARM misc devices. But for exemples I actually have a 13MB 
firmware as an initramfs that use 33MB of RAM with the following content 
:

app-admin/logrotate-3.8.3
app-admin/sudo-1.8.5_p2
app-admin/sysklogd-1.4.2_pre20061230-r2
app-antivirus/clamd-stream-client-1.3
app-arch/bzip2-1.0.6-r3
app-arch/gzip-1.5
app-arch/tar-1.26
app-editors/elvis-2.2.0-r4
app-shells/bash-4.2_p37
dev-libs/libnl-1.1-r3
dev-libs/libnl-3.2.14
dev-libs/libpcre-8.30-r2
dev-libs/lzo-2.06
dev-libs/openssl-1.0.0j
dev-libs/popt-1.16-r1
flx/flash-9999
flx/flx-0.1.34
flx/flx-bash-9999
flx/flx-etc-9999
flx/genrules-9999
flx/init-0.1.34
flx/init-alix-leds-3.0
flx/init-clamav-0.92.1
flx/init-dnsmasq-2.32
flx/init-ntp-4.2
flx/init-openssh-4.5
flx/init-openvpn-2.0.9
flx/init-scripts-0.3.42
flx/init-squid-2.6
flx/init-thttpd-2.25b
flx/init-vixie-cron-3.0.1
flx/init-wdd-0.1.34
flx/monitor-9999
flx/remount-0.1.34
flx/system-conf-0.1.15
flx/update-9999
flx/validate-boot-9999
flx/wdd-0.1.34
mail-mta/exim-4.80.1
net-analyzer/iptraf-ng-1.1.3.1-r1
net-analyzer/net-snmp-5.7.2
net-analyzer/netcat-110-r9
net-analyzer/tcpdump-4.3.0
net-analyzer/traceroute-2.0.18
net-dialup/freeradius-2.2.0
net-dns/dnsmasq-2.63
net-dns/host-20070128-r1
net-dns/libidn-1.25
net-firewall/arptables-0.0.3.4-r2
net-firewall/ebtables-2.0.10.4
net-firewall/iptables-1.4.16.3
net-firewall/rtsp-conntrack-3.3
net-firewall/xtables-addons-1.45
net-libs/libpcap-1.3.0-r1
net-mail/mailbase-1
net-misc/bridge-utils-1.4
net-misc/curl-7.26.0
net-misc/ifenslave-1.1.0-r6
net-misc/iputils-20101006-r2
net-misc/ntp-4.2.6_p5-r1
net-misc/openssh-5.9_p1-r4
net-misc/openvpn-2.2.2
net-misc/stunnel-4.44
net-misc/vconfig-1.9
net-misc/wol-0.7.1
net-proxy/haproxy-1.4.22
net-proxy/squid-3.1.22
net-proxy/squidguard-1.4-r4
net-wireless/hostapd-9999
sys-apps/alix-leds-3.0
sys-apps/attr-2.4.46-r1
sys-apps/baselayout-2.1-r1
sys-apps/busybox-1.1.0
sys-apps/coreutils-8.20
sys-apps/diffutils-3.2
sys-apps/ethtool-3.0
sys-apps/file-5.11
sys-apps/findutils-4.4.2-r1
sys-apps/gawk-4.0.1
sys-apps/grep-2.14
sys-apps/hwids-20130114
sys-apps/i2c-tools-3.0.2
sys-apps/iproute2-3.3.0
sys-apps/less-451
sys-apps/lm_sensors-3.3.1
sys-apps/missing-links-5
sys-apps/module-init-tools-3.16-r2
sys-apps/net-tools-1.60_p20120127084908
sys-apps/pciutils-3.1.10
sys-apps/sed-4.2.1-r1
sys-apps/shadow-4.1.4.3
sys-apps/sysvinit-2.88-r3
sys-apps/util-linux-2.21.2
sys-apps/which-2.20
sys-boot/grub-0.97-r12
sys-devel/binutils-2.22-r1
sys-devel/gcc-4.6.3
sys-devel/libtool-2.4-r1
sys-fs/e2fsprogs-1.42
sys-fs/static-dev-0.1
sys-kernel/gentoo-allin1-3.5.7
sys-libs/cracklib-2.8.19
sys-libs/db-4.8.30
sys-libs/e2fsprogs-libs-1.42
sys-libs/glibc-2.15-r3
sys-libs/libcap-2.22
sys-libs/ncurses-5.9-r2
sys-libs/readline-6.2_p1
sys-libs/zlib-1.2.7
sys-process/procps-3.2.8_p11
sys-process/psmisc-22.16
sys-process/vixie-cron-4.1-r12
www-servers/thttpd-2.26.4-r1

Beber

On 2013-01-18 20:37, Mike Frysinger wrote:
> On Thursday 17 January 2013 05:43:09 Kfir Lavi wrote:
>> I just killed some processes and arrived to bare system 64MB.
>> Now just sshd, bash and agetty are showing in ps aux as real 
>> processes.
>> The other are kernel processes.
>> The kernel is pretty lean. Should I expect 64MB as the initial 
>> system
>> memory use?
>> Can I lower it?
>
> you have to look at where exactly memory is being used
>
> when the kernel boots, it very clearly tells you what it is using as 
> a
> starting point.  in dmesg, look for the line starting with 
> "Available:".
>
> from there, run `ps auxOR`.  the VSZ/RSS fields will tell you how 
> much memory
> each process is using (be aware that some of it is shared e.g. glibc 
> shared
> libs).
>
> then look at /proc/meminfo and see what is being used where.
>
> i'm assuming your system is booting off a real rootfs (e.g. not an 
> initramfs)
> so usage there shouldn't be a big problem.
>
> with that information, you can see what can be shrunk or what is 
> unavoidable.
>
> FWIW, i built Blackfin systems w/16MiB of RAM fairly easily.  but 
> those used
> uClibc and busybox (and dropbear for ssh).  while much of userland 
> was built
> with -Os, the kernel and uClibc were built with -O2 as the 
> space/optimization
> tradeoffs didn't seem worth it.
> -mike


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-embedded] Small standard system take 84MB of ram after startup. How to lower memory footprint?
  2013-01-21 11:32           ` Bertrand Jacquin
@ 2013-01-22 12:53             ` Peter Stuge
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Stuge @ 2013-01-22 12:53 UTC (permalink / raw
  To: gentoo-embedded

Bertrand Jacquin wrote:
> I think I should take some times to document and public the things I
> wrote on my spare time for embedded devices.

Go for it. How do you produce that firmware?


//Peter


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-01-22 12:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-16 20:46 [gentoo-embedded] Small standard system take 84MB of ram after startup. How to lower memory footprint? Kfir Lavi
2013-01-16 21:05 ` Mike Frysinger
2013-01-17  4:20   ` Kfir Lavi
2013-01-17  9:25     ` Markos Chandras
2013-01-17 10:43       ` Kfir Lavi
2013-01-17 10:46         ` Kfir Lavi
2013-01-18 15:19         ` Christian Bricart
2013-01-18 19:37         ` Mike Frysinger
2013-01-21 11:32           ` Bertrand Jacquin
2013-01-22 12:53             ` Peter Stuge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox