New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed two malloc related bugs #2

Closed
wants to merge 1 commit into
from

Conversation

2 participants
@mver

mver commented Oct 26, 2012

Hey,

I noticed two *alloc problems and did a fix.

Markus

carz2 pushed a commit to carz2/android_platform_dalvik that referenced this pull request Nov 15, 2012

Don't crash in dvmQuasiAtomicsShutdown if we never ran dvmQuasiAtomic…
…sStartup.

dalvikvm --help would fail here:

  #0  __pthread_mutex_destroy (mutex=0x0) at pthread_mutex_destroy.c:28
  #1  0xf7b36e13 in dvmDestroyMutex (pMutex=0x0) at dalvik/vm/Thread.h:465
  #2  dvmQuasiAtomicsShutdown () at dalvik/vm/Atomic.cpp:188
  #3  0xf7b65781 in dvmShutdown () at dalvik/vm/Init.cpp:1889
  #4  0xf7b65f31 in ~ScopedShutdown (this=<synthetic pointer>, __in_chrg=<optimized out>) at dalvik/vm/Init.cpp:1317
  #5  dvmStartup (argc=11, argv=0x804b360, ignoreUnrecognized=false, pEnv=0x804b398) at dalvik/vm/Init.cpp:1548
  #6  0xf7b790e2 in JNI_CreateJavaVM (p_vm=0xffffc758, p_env=0xffffc75c, vm_args=0xffffc760) at dalvik/vm/Jni.cpp:3502
  #7  0x08048958 in main (argc=13, argv=0xffffc8b8) at dalvik/dalvikvm/Main.cpp:212

Change-Id: I8c833ca5ea454d9b2d1714a569fb728562088659

deVorteX pushed a commit to TeamSourcery/platform_dalvik that referenced this pull request Dec 9, 2012

Glenn Kasten
apps forked from zygote run in default cgroup
zygote and it's children, including system_server and all app processes,
currently start in root cgroup.  Most app threads eventually join either
bg_noninteractive or foreground cgroups, but we can't depend on that.
This change puts system_server and all app processes in the system
default cgroup aka foreground instead.

See also bug 6376294 which will provide a more general way of configuring cgroups.

Excerpt of ps -P -t before fix.  Note that app u0_a7 has some threads in root cgroup:
USER     PID   PPID  VSIZE  RSS    PCY  WCHAN    PC         NAME
root      91    1     441308 35052     ffffffff 400d4bf8 S zygote
root      1838  91    441308 35052     c009c0c4 400d5bdc S ReferenceQueueD
root      1840  91    441308 35052     c009c0c4 400d5bdc S FinalizerDaemon
root      1842  91    441308 35052     c009c0c4 400d5bdc S FinalizerWatchd
u0_a7     1378  91    461036 28676     ffffffff 400d59b0 S com.google.android.calendar
u0_a7     1380  1378  461036 28676     c009c0c4 400d5bdc S GC
u0_a7     1383  1378  461036 28676     c00827fc 400d5494 S Signal Catcher
u0_a7     1384  1378  461036 28676     c0408d14 400d569c S JDWP
u0_a7     1385  1378  461036 28676     c009c0c4 400d5bdc S Compiler
u0_a7     1386  1378  461036 28676     c009c0c4 400d5bdc S ReferenceQueueD
u0_a7     1387  1378  461036 28676     c009c0c4 400d5bdc S FinalizerDaemon
u0_a7     1388  1378  461036 28676     c009c0c4 400d5bdc S FinalizerWatchd
u0_a7     1389  1378  461036 28676 fg  c035ac7c 400d4ad4 S Binder_1
u0_a7     1390  1378  461036 28676 fg  c035ac7c 400d4ad4 S Binder_2
u0_a7     1393  1378  461036 28676     c009c0c4 400d5bdc S pool-1-thread-1
u0_a7     1395  1378  461036 28676 bg  c009c0c4 400d5bdc S AsyncTask #1
u0_a7     1410  1378  461036 28676     c009c0c4 400d5bdc S pool-2-thread-1
u0_a7     1411  1378  461036 28676 bg  c009c0c4 400d5bdc S AsyncTask #2
u0_a7     1428  1378  461036 28676     c01258cc 400d59b0 S AsyncQueryWorke
u0_a7     1469  1378  461036 28676 bg  c009c0c4 400d5bdc S AsyncTask #3
u0_a7     1563  1378  461036 28676     c009c0c4 400d5bdc S pool-3-thread-1
u0_a7     1564  1378  461036 28676 bg  c009c0c4 400d5bdc S AsyncTask #4

After the fix, now only kernel workers and native system services run in root cgroup:
USER     PID   PPID  VSIZE  RSS    PCY  WCHAN    PC         NAME
root      91    1     441304 35048     ffffffff 4007abf8 S zygote
root      1490  91    441304 35048     c009c0c4 4007bbdc S ReferenceQueueD
root      1491  91    441304 35048     c009c0c4 4007bbdc S FinalizerDaemon
root      1493  91    441304 35048     c009c0c4 4007bbdc S FinalizerWatchd
u0_a7     1335  91    460032 32124 bg  ffffffff 4007b9b0 S com.google.android.calendar
u0_a7     1337  1335  460032 32124 bg  c009c0c4 4007bbdc S GC
u0_a7     1338  1335  460032 32124 bg  c00827fc 4007b494 S Signal Catcher
u0_a7     1341  1335  460032 32124 bg  c0408d14 4007b69c S JDWP
u0_a7     1342  1335  460032 32124 bg  c009c0c4 4007bbdc S Compiler
u0_a7     1343  1335  460032 32124 bg  c009c0c4 4007bbdc S ReferenceQueueD
u0_a7     1344  1335  460032 32124 bg  c009c0c4 4007bbdc S FinalizerDaemon
u0_a7     1345  1335  460032 32124 bg  c009c0c4 4007bbdc S FinalizerWatchd
u0_a7     1346  1335  460032 32124 fg  c035ac7c 4007aad4 S Binder_1
u0_a7     1347  1335  460032 32124 fg  c035ac7c 4007aad4 S Binder_2
u0_a7     1351  1335  460032 32124 bg  c009c0c4 4007bbdc S AsyncTask #1
u0_a7     1380  1335  460032 32124 bg  c01258cc 4007b9b0 S AsyncQueryWorke
u0_a7     1417  1335  460032 32124 bg  c009c0c4 4007bbdc S AsyncTask #2
u0_a7     1452  1335  460032 32124 bg  c009c0c4 4007bbdc S AsyncTask #3
u0_a7     1555  1335  460032 32124 bg  c01258cc 4007b9b0 S Thread-134
u0_a7     1691  1335  460032 32124 bg  c009c0c4 4007bbdc S pool-3-thread-1
u0_a7     1692  1335  460032 32124 bg  c009c0c4 4007bbdc S AsyncTask #4

Not shown, but system_server also runs in fg (it already did; this change
didn't affect that).

Change-Id: I516960a102c9d59fc9bfb5888d90a7645d178dcf
@willnorris

This comment has been minimized.

Show comment
Hide comment
@willnorris

willnorris Jun 25, 2013

To report bugs or submit patches to Android, please follow the instructions at http://source.android.com/source/contributing.html. More information on these mirrors (like the fact that issues and pull requests are ignored) is now available at http://android.github.io/.

To report bugs or submit patches to Android, please follow the instructions at http://source.android.com/source/contributing.html. More information on these mirrors (like the fact that issues and pull requests are ignored) is now available at http://android.github.io/.

@willnorris willnorris closed this Jun 25, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment