Tuesday, April 17, 2012

Memory Comparisons - Headless Android vs. Full Android

After some questions on the blog about memory comparisons, I pulled some information together off of my Freescale development board. Here is the information I've pulled together. From what I see the information shows:

MemFree difference = 337320 kB - 265888 kB = 71432 kB saved (21%)

The other interesting one is with the Active in each case:

Active difference = 95892 kB - 44632 kB = 51260 kB saved (53%)

Here is the raw information from the memory usage off of my development board.

Using the standard Android image with no Headless Android changes:

Free shows:

# busybox free
              total         used         free       shared      buffers
  Mem:       442740       177932       264808            0         2000
 Swap:            0            0            0
Total:       442740       177932       264808

Here is the meminfo off of the development board.

# cat /proc/meminfo
MemTotal:         442740 kB
MemFree:          265888 kB
Buffers:            2000 kB
Cached:            79248 kB
SwapCached:            0 kB
Active:            95892 kB
Inactive:          46456 kB
Active(anon):      61140 kB
Inactive(anon):      328 kB
Active(file):      34752 kB
Inactive(file):    46128 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:             0 kB
HighFree:              0 kB
LowTotal:         442740 kB
LowFree:          265888 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         61108 kB
Mapped:            32100 kB
Shmem:               372 kB
Slab:               7888 kB
SReclaimable:       4164 kB
SUnreclaim:         3724 kB
KernelStack:        2056 kB
PageTables:         6276 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      221368 kB
Committed_AS:     929976 kB
VmallocTotal:    1433600 kB
VmallocUsed:       85784 kB
VmallocChunk:    1320964 kB



With the following process list.

# ps
USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
root      1     0     324    188   800e9ea4 0000875c S /init
root      2     0     0      0     80080268 00000000 S kthreadd
root      3     2     0      0     8006f8b4 00000000 S ksoftirqd/0
root      4     2     0      0     8007cacc 00000000 S events/0
root      5     2     0      0     8007cacc 00000000 S khelper
root      8     2     0      0     80086f80 00000000 S async/mgr
root      9     2     0      0     8007cacc 00000000 S pm
root      12    2     0      0     8007cacc 00000000 S suspend
root      81    2     0      0     800558a0 00000000 S usb_wakeup thre
root      82    2     0      0     800558a0 00000000 S usb_wakeup thre
root      240   2     0      0     800b925c 00000000 S sync_supers
root      242   2     0      0     800b9d3c 00000000 S bdi-default
root      244   2     0      0     8007cacc 00000000 S kblockd/0
root      258   2     0      0     8007cacc 00000000 S mxc_spi.0
root      266   2     0      0     8007cacc 00000000 S otg_switch/0
root      272   2     0      0     80294ca8 00000000 S khubd
root      295   2     0      0     8007cacc 00000000 S kmmcd
root      309   2     0      0     80315228 00000000 S pmic-event-thre
root      373   2     0      0     8007cacc 00000000 S rpciod/0
root      393   2     0      0     800b3904 00000000 S kswapd0
root      441   2     0      0     8007cacc 00000000 S aio/0
root      451   2     0      0     8007cacc 00000000 S nfsiod
root      455   2     0      0     8007cacc 00000000 S crypto/0
root      1073  2     0      0     8022bd8c 00000000 S kapmd
root      1148  2     0      0     802bb8d4 00000000 S file-storage
root      1199  2     0      0     8007cacc 00000000 S kstriped
root      1204  2     0      0     8007cacc 00000000 S kconservative/0
root      1209  2     0      0     8007cacc 00000000 S vpu_wq/0
root      1216  2     0      0     8007cacc 00000000 S esdhc_wq/0
root      1219  2     0      0     8007cacc 00000000 S esdhc_wq/0
root      1228  2     0      0     8007cacc 00000000 S usbhid_resumer
root      1231  2     0      0     8007cacc 00000000 S binder
root      1250  2     0      0     8032eefc 00000000 S mmcqd
root      1289  2     0      0     8007cacc 00000000 S l2cap
root      1290  2     0      0     804517f4 00000000 S krfcommd
root      1302  2     0      0     80315c1c 00000000 S mxc_ts
root      1303  1     300    156   800e9ea4 0000875c S /sbin/ueventd
root      1485  2     0      0     80247e28 00000000 S scsi_eh_0
root      1487  2     0      0     802aef98 00000000 S usb-storage
root      2147  2     0      0     8015a0e4 00000000 S jbd2/mmcblk0p2-
root      2148  2     0      0     8007cacc 00000000 S ext4-dio-unwrit
root      2149  2     0      0     800f9d94 00000000 S flush-179:0
root      2150  2     0      0     8015a0e4 00000000 S jbd2/mmcblk0p5-
root      2151  2     0      0     8007cacc 00000000 S ext4-dio-unwrit
root      2152  2     0      0     8015a0e4 00000000 S jbd2/mmcblk0p6-
root      2153  2     0      0     8007cacc 00000000 S ext4-dio-unwrit
root      2155  1     744    328   8006d5a0 6fd0c3ac S /system/bin/sh
system    2156  1     816    272   80343750 6fd0b6fc S /system/bin/servicemanager
root      2157  1     3872   588   ffffffff 6fd0bdac S /system/bin/vold
root      2158  1     3872   576   ffffffff 6fd0bdac S /system/bin/netd
root      2159  1     820    320   800e9ea4 6fd0b844 S /system/bin/dispd
root      2160  1     676    256   8037b6ac 6fd0c0cc S /system/bin/debuggerd
root      2161  1     83416  27160 800e9ea4 6fd0b844 S zygote
media     2162  1     27572  5492  ffffffff 6fd0b6fc S /system/bin/mediaserver
bluetooth 2163  1     1264   696   800e9ea4 6fd0c59c S /system/bin/dbus-daemon
root      2164  1     824    332   803fd98c 6fd0b45c S /system/bin/installd
keystore  2165  1     1752   424   8037b6ac 6fd0c0cc S /system/bin/keystore
radio     2166  1     5460   700   ffffffff 6fd0bdac S /system/bin/rild
root      2230  2     0      0     80247e28 00000000 S scsi_eh_1
root      2231  2     0      0     802aef98 00000000 S usb-storage
system    2256  2161  192540 38596 ffffffff 6fd0b6fc S system_server
root      2266  2     0      0     8007cacc 00000000 S z1xx_workq
app_17    2410  2161  99260  19152 ffffffff 6fd0c51c S com.android.inputmethod.latin
radio     2417  2161  109916 20816 ffffffff 6fd0c51c S com.android.phone
system    2419  2161  140892 20728 ffffffff 6fd0c51c S com.android.systemui
app_16    2485  2161  98312  22172 ffffffff 6fd0c51c S com.android.launcher
app_1     2498  2161  104776 22132 ffffffff 6fd0c51c S android.process.acore
app_11    2529  2161  105400 17672 ffffffff 6fd0c51c S com.android.mms
app_12    2534  2161  94620  17996 ffffffff 6fd0c51c S android.process.media
app_20    2558  2161  94648  17988 ffffffff 6fd0c51c S com.android.email
app_21    2568  2161  93140  16192 ffffffff 6fd0c51c S com.android.deskclock
app_26    2583  2161  92336  16520 ffffffff 6fd0c51c S com.android.providers.calendar
app_30    2593  2161  92368  16312 ffffffff 6fd0c51c S com.android.bluetooth
app_5     2600  2161  92172  15680 ffffffff 6fd0c51c S com.android.quicksearchbox
app_7     2611  2161  91804  14856 ffffffff 6fd0c51c S com.android.protips
app_10    2623  2161  92340  15004 ffffffff 6fd0c51c S com.android.music
app_19    2630  2161  93468  16588 ffffffff 6fd0c51c S com.cooliris.media
root      2766  2155  904    312   00000000 6fd0b45c R ps
Using the Headless Android image on my development board.

Free shows:

# busybox free
              total         used         free       shared      buffers
  Mem:       442740       105240       337500            0         1464
 Swap:            0            0            0
Total:       442740       105240       337500

Meminfo after five minutes shows:

# cat /proc/meminfo
MemTotal:         442740 kB
MemFree:          337320 kB
Buffers:            1464 kB
Cached:            57140 kB
SwapCached:            0 kB
Active:            44632 kB
Inactive:          35124 kB
Active(anon):      21168 kB
Inactive(anon):      200 kB
Active(file):      23464 kB
Inactive(file):    34924 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:             0 kB
HighFree:              0 kB
LowTotal:         442740 kB
LowFree:          337320 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         21160 kB
Mapped:            21564 kB
Shmem:               220 kB
Slab:               6108 kB
SReclaimable:       3268 kB
SUnreclaim:         2840 kB
KernelStack:         832 kB
PageTables:         1384 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      221368 kB
Committed_AS:     173048 kB
VmallocTotal:    1433600 kB
VmallocUsed:       69096 kB
VmallocChunk:    1343484 kB


With the following ps list:

# ps
USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
root      1     0     324    188   800e9ea4 0000875c S /init
root      2     0     0      0     80080268 00000000 S kthreadd
root      3     2     0      0     8006f8b4 00000000 S ksoftirqd/0
root      4     2     0      0     8007cacc 00000000 S events/0
root      5     2     0      0     8007cacc 00000000 S khelper
root      8     2     0      0     80086f80 00000000 S async/mgr
root      9     2     0      0     8007cacc 00000000 S pm
root      12    2     0      0     8007cacc 00000000 S suspend
root      81    2     0      0     800558a0 00000000 S usb_wakeup thre
root      82    2     0      0     800558a0 00000000 S usb_wakeup thre
root      240   2     0      0     800b925c 00000000 S sync_supers
root      242   2     0      0     800b9d3c 00000000 S bdi-default
root      244   2     0      0     8007cacc 00000000 S kblockd/0
root      258   2     0      0     8007cacc 00000000 S mxc_spi.0
root      266   2     0      0     8007cacc 00000000 S otg_switch/0
root      272   2     0      0     80294ca8 00000000 S khubd
root      295   2     0      0     8007cacc 00000000 S kmmcd
root      309   2     0      0     80315228 00000000 S pmic-event-thre
root      373   2     0      0     8007cacc 00000000 S rpciod/0
root      393   2     0      0     800b3904 00000000 S kswapd0
root      441   2     0      0     8007cacc 00000000 S aio/0
root      451   2     0      0     8007cacc 00000000 S nfsiod
root      455   2     0      0     8007cacc 00000000 S crypto/0
root      1073  2     0      0     8022bd8c 00000000 S kapmd
root      1148  2     0      0     802bb8d4 00000000 S file-storage
root      1199  2     0      0     8007cacc 00000000 S kstriped
root      1204  2     0      0     8007cacc 00000000 S kconservative/0
root      1209  2     0      0     8007cacc 00000000 S vpu_wq/0
root      1216  2     0      0     8007cacc 00000000 S esdhc_wq/0
root      1219  2     0      0     8007cacc 00000000 S esdhc_wq/0
root      1228  2     0      0     8007cacc 00000000 S usbhid_resumer
root      1231  2     0      0     8007cacc 00000000 S binder
root      1250  2     0      0     8032eefc 00000000 S mmcqd
root      1289  2     0      0     8007cacc 00000000 S l2cap
root      1290  2     0      0     804517f4 00000000 S krfcommd
root      1302  2     0      0     80315c1c 00000000 S mxc_ts
root      1303  1     300    156   800e9ea4 0000875c S /sbin/ueventd
root      1489  2     0      0     80247e28 00000000 S scsi_eh_0
root      1491  2     0      0     802aef98 00000000 S usb-storage
root      2147  2     0      0     8015a0e4 00000000 S jbd2/mmcblk0p2-
root      2148  2     0      0     8007cacc 00000000 S ext4-dio-unwrit
root      2149  2     0      0     800f9d94 00000000 S flush-179:0
root      2150  2     0      0     8015a0e4 00000000 S jbd2/mmcblk0p5-
root      2151  2     0      0     8007cacc 00000000 S ext4-dio-unwrit
root      2152  2     0      0     8015a0e4 00000000 S jbd2/mmcblk0p6-
root      2153  2     0      0     8007cacc 00000000 S ext4-dio-unwrit
root      2155  1     744    340   8006d5a0 6fd0c3ac S /system/bin/sh
system    2156  1     816    252   80343750 6fd0b6fc S /system/bin/servicemanager
root      2157  1     3872   564   ffffffff 6fd0bdac S /system/bin/vold
root      2158  1     3868   572   ffffffff 6fd0bdac S /system/bin/netd
root      2159  1     820    320   800e9ea4 6fd0b844 S /system/bin/dispd
root      2160  1     676    256   8037b6ac 6fd0c0cc S /system/bin/debuggerd
root      2161  1     83412  27140 800e9ea4 6fd0b844 S zygote
media     2162  1     24300  5232  ffffffff 6fd0b6fc S /system/bin/mediaserver
bluetooth 2163  1     1264   564   800e9ea4 6fd0c59c S /system/bin/dbus-daemon
root      2164  1     824    336   803fd98c 6fd0b45c S /system/bin/installd
keystore  2165  1     1752   424   8037b6ac 6fd0c0cc S /system/bin/keystore
radio     2166  1     4444   672   ffffffff 6fd0bdac S /system/bin/rild
root      2230  2     0      0     80247e28 00000000 S scsi_eh_1
root      2231  2     0      0     802aef98 00000000 S usb-storage
system    2255  2161  130548 30352 ffffffff 6fd0b6fc S system_server
root      2381  2155  904    308   00000000 6fd0b45c R ps








5 comments:

  1. I've been looking at the figures from a pandaboard running a version of headless android. In the case of your figures surfaceflinger doesn't seem to be running in either scenario, I would have expected it to be running in the standard android case. In my case surfaceflinger is running in both scenarios!
    Did you kill these processes on your system?

    ReplyDelete
  2. Andy, that's a good question. I didn't manually kill it so it's odd you are seeing it and I am not. Double check the code and make sure you have the surfacefinger object is not being instantiated?

    ReplyDelete
  3. Ok, I'll check the code. I'm actually having other problems as the android system is not up, the activity and package managers are both crashing with null pointer exceptions, so I've probably got some deeper problems. Thanks.

    ReplyDelete
  4. Now trying with a beaglebone and gingerbread. Your patch seemed much happier with that than with ICS on pandaboard. I've now got problems with the phone service and various associated services dying and then being restarted. Did you have to turn these off somehow (in the init.rc)?

    ReplyDelete
    Replies
    1. I wasn't seeing that, but probably because the development board I'm using was never intended to have phone functionality so it was already disabled. If you figure out what is causing it, I'm sure others would be interested. The only thing I can think of it to double check that the phone services are all disabled.

      My patches were against Gingerbread so that makes sense why it would not work so swell with ICS.

      Delete