-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Turner wrote:
[...]
> That can only be said for files that are mapped read-only. It doesn't apply
> for
> anything that is shared copy-on-write (e.g. the Zygote process pages, as
> well
> as initial heap) and non-file mappings.

Ah, I'd forgotten about copy-on-write.

[...]
> But it *is* hard to define what "allocation failure" really means if you
> have
> memory overcommit enabled.

Yes, that's precisely my point!

In fact, I find the OOM killer behaviour deeply suspect. I do not
believe that randomly killing processes is *ever* the right thing to do
on a reliable system, as it completely denies the application the
ability to properly clean up after itself. What happens if the app is in
the middle of a file operation at the time? You lose, that's what. (Not
*everything* can be journalled.)

If I was going to have overcommit enabled, I'd much rather have the
allocation failures exposed to the application in the form of the
appropriate signal when the application fails to access the page. SIGBUS
('bad memory access') would seem to be the suitable one here. That
allows the application to catch it and do any applicable cleanup, and
any application that doesn't care will be killed anyway.

This would also have the advantage that you'd be much more likely to
terminate the offending process; in my experience the OOM killer has a
nasty tendency to home in on the wrong process. Hopefully that's been
fixed in the Android patches.

Incidentally, does Android use rlimits to impose per-process memory limits?

- --
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ "People who think they know everything really annoy those of us who
│ know we don't." --- Bjarne Stroustrup
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFKrth5f9E0noFvlzgRAjblAJ44qz7poU+R6hKbmAJTGrO5FwwerwCeKVSb
6ucGqn6l8sWJ8mlanQ8PE5s=
=Y3tU
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Reply via email to