Use /dev/ashmem for Shmem on android




9 years ago
6 years ago


(Reporter: cjones, Assigned: cjones)


(Blocks 1 bug)

Firefox Tracking Flags

(Not tracked)



(2 attachments)

android has decided not to support SysV shmem (OK) or POSIX shmem slash /dev/shm (sigh), and instead created two new shmem implementations in their kernel.  One is /dev/ashmem, which is non-physically-contiguous shmem that can be thrown out at any time when there's memory pressure (that is, just like /dev/shm except the throw-out-at-arbitrary-times bit).  It appears that mappings can be pinned, but I'm not sure that's a game we want to play.  The other is /dev/pmem, which allocates physically contiguous regions that can't be thrown out.  We don't want to touch that except for something like a video decoder.

The current android shmem implementation is mapping real files, and it's slow.  This bug covers getting us to use /dev/ashmem.  We'll need to gracefully deal with mappings being tossed out behind our back, but that's (probably) post-b1 work for a followup.
This blocks b1.
tracking-fennec: --- → ?
Comment on attachment 473895 [details] [diff] [review]
part 1: Factor out chromium-implemented SharedMemoryBasic in preparation for an android-specific impl

Nothing objectionable in here!
Attachment #473895 - Flags: review?(joe) → review+
Comment on attachment 473935 [details] [diff] [review]
part 2: Add a SharedMemoryBasic impl that uses /dev/ashmem on android

How about __android_log_print for logging? strerr isn't too useful on android most of the time unless you're redirecting it to a file. See for an example.
Attachment #473935 - Flags: review?(mwu) → review+
Blocks: 595357
tracking-fennec: ? → ---
You need to log in before you can comment on or make changes to this bug.